function SaveLocation() { $db = new Db(); // print ("Ready to add a new location<br>"); $Long = $db->quote($this->getLongitude()); $Lat = $db->quote($this->getLatitude()); $GPS = $db->quote($this->getGPS()); $Note = $db->quote($this->getLocationNote()); $query = "insert into Locations (Longitude, Latitude, GPSCoordinates, LocationNotes) values ({$Long}, {$Lat}, {$GPS}, {$Note});"; $results = $db->insert($query); // print ("Results were: " . $results . "<br>"); // print ("Saved new location<br>"); return $results; }
public function addcompany() { $errors = Error::get("error"); if (!count($errors) || $errors == "") { $db = new Db(); if (Session::read("userid")) { $user_id = Session::read("userid"); //print_r($user_id); exit(); // $user_id=$db->quote($this->user_id); $name = $db->quote($this->name); $email = $db->quote($this->email); $website = $db->quote($this->website); $phone = $db->quote($this->phone); $city = $db->quote($this->city); $location = $db->quote($this->location); $specialization = $db->quote($this->specialization); $description = $db->quote($this->description); $query = "INSERT INTO " . $this->tableName() . " (user_id,name,city,location,website,email,phone,specialization,description,active) \n VALUES({$user_id},{$name},{$city},{$location},{$website},{$email},{$phone},{$specialization},{$description},1)"; if ($db->query($query)) { //print_r($query); exit(); if ($db->affectedRows()) { return true; } } } } return false; }
public function save() { if (is_numeric($this->id)) { $db = new Db(); $id = $db->quote($this->id); $active = $db->quote($this->active); $query = "INSERT INTO " . $this->tableName() . " (id, active)VALUES({$id} , {$active}) \n ON DUPLICATE KEY UPDATE \n active={$active}"; if ($db->query($query)) { if ($db->affectedRows()) { return true; } } } return false; }
function addquestion() { $db = new Db(); $question = $db->quote($this->question); $heading = $db->quote($this->heading); $topic = $db->quote($this->topic_id); $city = $db->quote($this->city); $query = "INSERT INTO " . $this->tableName() . " (question, heading,topic_id, city, active) \n VALUES({$question},{$heading},{$topic},{$city},1)"; if ($db->query($query)) { //print_r($query); exit(); if ($db->affectedRows()) { return true; } } }
public function save() { if (is_numeric($this->country_id) && is_string($this->country_name)) { $db = new Db(); $id = $db->quote($this->country_id); $name = $db->quote($this->country_name); $active = $db->quote($this->country_status); $query = "INSERT INTO " . $this->tableName() . " (id, name, active) VALUES({$id},{$name} , {$active}) \n ON DUPLICATE KEY UPDATE \n name= {$name}, active={$active}"; if ($db->query($query)) { if ($db->affectedRows()) { return true; } } } return false; }
public function save() { // if(is_numeric($this->id) && is_string($this->name)){ $db = new Db(); // $id = $db->quote($this->id); $name = $db->quote($this->name); $url = $db->quote($this->url); $active = $db->quote($this->pagecategory_status); $query = "INSERT INTO " . $this->table() . " (name,url, active) VALUES({$name},{$url} , {$active}) \n ON DUPLICATE KEY UPDATE \n name= {$name}, active={$active}"; if ($db->query($query)) { if ($db->affectedRows()) { return true; } } // } return false; }
public function save() { if (is_numeric($this->city_id) && is_string($this->city_name)) { $db = new Db(); $id = $db->quote($this->city_id); $state_id = $db->quote($this->state_id); $name = $db->quote($this->city_name); $active = $db->quote($this->city_status); $query = "INSERT INTO " . $this->tableName() . " (id, state_id, name, active) VALUES({$id},{$state_id}, {$name} , {$active}) \n ON DUPLICATE KEY UPDATE \n name={$name}, state_id={$state_id}, active={$active}"; if ($db->query($query)) { return true; } else { Error::set($db->error()); } } return false; }
public function delete($arg) { if (!is_numeric($arg)) { return FALSE; } $db = new Db(); $id = $db->quote($arg); $results = $db->query("DELETE from myfish.myfish where id = {$id}"); }
public function getName() { if (is_numeric($this->access_id)) { $db = new Db(); $id = $db->quote($this->access_id); $query = "SELECT * FROM " . $this->tableName() . " WHERE id = " . $id; return $db->select($query); } return false; }
public function getPageTypeUrl() { $db = new Db(); $page_type_id = $db->quote($this->access_id); $query = "SELECT url FROM " . $this->tableName() . " where id = {$page_type_id} AND active = 1"; $row = $db->select($query); if (count($row)) { return $row[0]['url']; } return ""; }
function SaveWeatherData() { $db = new Db(); // print ("Ready to add a new weather<br>"); $ObservationDate = $db->quote($this->getObservationDate()); $ObservationTime = $db->quote($this->getTime()); $Temp = $db->quote($this->getTemperature()); $Conditions = $db->quote($this->getConditions()); $results = $db->insert("insert into Weather (ObservationTIme, ObservationDate, TemperatureF, Conditions, DateEntered) values ({$ObservationTime}, {$ObservationDate}, {$Temp}, {$Conditions}, now());"); // print ("Saved new weather<br>"); return $results; }
public static function insert($table, $data = array()) { $cols = implode(',', array_keys($data)); $values = implode(',', array_map(function ($val) { return Db::quote($val); }, $data)); $sql = "INSERT INTO {$table} ({$cols}) VALUES ({$values})"; if (self::execute($sql)) { return self::getPDO()->lastInsertId(); } else { return false; } }
public static function getDocumentType($id) { if ($id) { $db = new Db(); $id = $db->quote($id); $query = "SELECT * FROM document_type WHERE id = {$id} AND active = 1"; $row = $db->select($query); if (strlen($row[0]['type'])) { return $row[0]['type']; } } return "Public"; }
public function save() { if (is_numeric($this->id) && is_string($this->name)) { $db = new Db(); $id = $db->quote($this->id); $user_id = $db->quote($this->user_id); $city_name = $db->quote($this->city_name); $locality = $db->quote($this->locality); $builder = $db->quote($this->builder_name); $project = $db->quote($this->project_name); $clear = $db->quote($this->clear_title); $legal_risk = $db->quote($this->legal_risk); $legal_description = $db->quote($this->legal_description); $active = $db->quote($this->active); $query = "INSERT INTO " . $this->tableName() . " (user_id,city_name,locality,builder_name,project_name,clear_title,legal_risk,legal_description,active) \n VALUES({$user_id},{$city_name},{$locality},{$builder},{$project},{$clear},{$legal_risk},{$legal_description}, {$active})"; if ($db->query($query)) { if ($db->affectedRows()) { return true; } } } return false; }
function GetSoil($arg) { if (!is_numeric($arg)) { return FALSE; } $db = new Db(); $SoilID = $db->quote($arg); $results = $db->select("SELECT * from Soils where SoilID = {$SoilID} limit 1"); foreach ($results as $result) { $soil = new soil(); $soil->hydrate($result); } return $soil; }
public function join($alias_from, $rel_name, $alias_to_nr, $conditions = array()) { $alias_to = 't' . $alias_to_nr; $model = array('model' => $this->model_to, 'connection' => call_user_func(array($this->model_to, 'connection')), 'table' => array(call_user_func(array($this->model_to, 'table')), $alias_to), 'primary_key' => call_user_func(array($this->model_to, 'primary_key')), 'join_type' => \Arr::get($conditions, 'join_type') ?: \Arr::get($this->conditions, 'join_type', 'left'), 'join_on' => array(), 'columns' => $this->select($alias_to), 'rel_name' => strpos($rel_name, '.') ? substr($rel_name, strrpos($rel_name, '.') + 1) : $rel_name, 'relation' => $this, 'where' => \Arr::get($conditions, 'where', array()), 'order_by' => \Arr::get($conditions, 'order_by') ?: \Arr::get($this->conditions, 'order_by', array())); var_dump($model); exit; reset($this->key_to); foreach ($this->key_from as $key) { $key_to = current($this->key_to); $alias = array(); if ($key instanceof \Fuel\Core\Database_Query_Builder_Select) { $key = $key->compile(); $key = \Str::tr($key, array('alias_to' => $alias_to, 'alias_from' => $alias_from, $rel_name => $alias_to)); $key = \DB::expr('(' . $key . ')'); $alias[0] = $key; } else { $alias[0] = $alias_from . '.' . $key; } $alias[1] = '='; if ($key_to instanceof \Fuel\Core\Database_Query_Builder_Select) { $key_to = current($this->key_to); $key_to = $key_to->compile(); $key_to = \Str::tr($key_to, array('alias_to' => $alias_to, 'alias_from' => $alias_from, $rel_name => $alias_to)); $key_to = \DB::expr('(' . $key_to . ')'); $alias[2] = $key_to; } else { $alias[2] = $alias_to . '.' . $key_to; } $model['join_on'][] = $alias; next($this->key_to); } foreach (array(\Arr::get($this->conditions, 'where', array()), \Arr::get($conditions, 'join_on', array())) as $c) { foreach ($c as $key => $condition) { !is_array($condition) and $condition = array($key, '=', $condition); if (!$condition[0] instanceof \Fuel\Core\Database_Expression and strpos($condition[0], '.') === false) { $condition[0] = $alias_to . '.' . $condition[0]; } is_string($condition[2]) and $condition[2] = \Db::quote($condition[2], $model['connection']); $model['join_on'][] = $condition; } } return array($rel_name => $model); }
public function join($alias_from, $rel_name, $alias_to_nr, $conditions = array()) { $alias_to = 't' . $alias_to_nr; $model = array('model' => $this->model_to, 'connection' => call_user_func(array($this->model_to, 'connection')), 'table' => array(call_user_func(array($this->model_to, 'table')), $alias_to), 'primary_key' => call_user_func(array($this->model_to, 'primary_key')), 'join_type' => \Arr::get($conditions, 'join_type') ?: \Arr::get($this->conditions, 'join_type', 'left'), 'join_on' => array(), 'columns' => $this->select($alias_to), 'rel_name' => strpos($rel_name, '.') ? substr($rel_name, strrpos($rel_name, '.') + 1) : $rel_name, 'relation' => $this, 'where' => \Arr::get($conditions, 'where', array()), 'order_by' => \Arr::get($conditions, 'order_by') ?: \Arr::get($this->conditions, 'order_by', array())); reset($this->key_to); foreach ($this->key_from as $key) { $model['join_on'][] = array($alias_from . '.' . $key, '=', $alias_to . '.' . current($this->key_to)); next($this->key_to); } foreach (\Arr::get($this->conditions, 'where', array()) as $key => $condition) { !is_array($condition) and $condition = array($key, '=', $condition); if (!$condition[0] instanceof \Fuel\Core\Database_Expression and strpos($condition[0], '.') === false) { $condition[0] = $alias_to . '.' . $condition[0]; } is_string($condition[2]) and $condition[2] = \Db::quote($condition[2], $model['connection']); $model['join_on'][] = $condition; } return array($rel_name => $model); }
public function save() { if (empty($this->data)) { return false; } $db = Application::getDb(); $data = array(); if (!$this->exists()) { foreach ($this->data as $key => $value) { if ($value === null) { $value = ''; } $data[$key] = $value; } $ret = $db->insert($this->tableName, $data); if (array_search('id', $this->primaryKey) !== false) { $this->set('id', $db->lastInsertId()); } $this->fresh = true; return $ret; } if (empty($this->changedData)) { return true; } foreach ($this->changedData as $key => $value) { if ($value === null) { $value = ''; } $data[$key] = $value; } $this->changedData = array(); $where = array(); foreach ($this->primaryKey as $field) { $where[] = "`{$field}`=" . Db::quote($this->data[$field]); } $where = implode(' AND ', $where); return $db->update($this->tableName, $data, $where); }
public static function quoteInto($value, $bind = array()) { if (func_num_args() > 2) { $args = func_get_args(); foreach ($args as $key => $val) { if ($key != 0 && strpos($value, self::PLACEHOLDER)) { $value = substr($value, 0, strpos($value, self::PLACEHOLDER)) . Db::quote($val) . substr(strstr($value, self::PLACEHOLDER), 1); } } return $value; } elseif (is_array($bind)) { foreach ($bind as $key => $val) { if (is_string($key)) { $value = str_replace($key, Db::quote($val), $value); } elseif (strpos($value, self::PLACEHOLDER)) { $value = substr($value, 0, strpos($value, self::PLACEHOLDER)) . Db::quote($val) . substr(strstr($value, self::PLACEHOLDER), 1); } } return $value; } else { return str_replace(self::PLACEHOLDER, Db::quote($bind), $value); } }
public function save() { if (is_numeric($this->id) && is_string($this->legal_service)) { $db = new Db(); $id = $db->quote($this->id); $legal_service = $db->quote($this->legal_service); $description = $db->quote($this->description); $cost = $db->quote($this->cost); $time = $db->quote($this->time); $active = $db->quote($this->active); $query = "INSERT INTO " . $this->tableName() . " (id,legal_service,description,cost,time, active) VALUES({$id},{$legal_service},{$description},{$cost},{$time} , {$active}) \n ON DUPLICATE KEY UPDATE \n legal_service= {$legal_service},description={$description},cost={$cost},time={$time} active={$active}"; if ($db->query($query)) { if ($db->affectedRows()) { return true; } } } return false; }
<!doctype html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Broneerimine Melissis</title> <link rel="stylesheet" href="css/style.css"> </head> <body style="text-align: center"> <h1>Result</h1> <?php include_once "db.php"; $db = new Db(); if (isset($_POST['submit'])) { $name = $db->quote($_POST['nimi']); $phone = $db->quote($_POST['phone']); $email = $db->quote($_POST['email']); $date = $db->quote($_POST['date']); $time = $db->quote($_POST['time']); $arv = $db->quote($_POST['arv']); $eelroad = $db->quote($_POST['eelroad']); $pohiroad = $db->quote($_POST['põhiroad']); $jarelroad = $db->quote($_POST['järelroad']); if ($name == '' || $phone == '' || $email == '' || $date == '' || $time == '' || $arv == '' || $eelroad == '' || $pohiroad == '' || $jarelroad == '') { // generate error message $error = 'ERROR: Palun täida kõik väljad!'; $_SESSION['status'] = 'error'; header("Location: failure.php"); } else { $db->query("INSERT INTO broneering (nimi,telefon,email,date,time,number,eelroad,pohiroad,jarelroad)\nVALUES ({$name},{$phone},{$email},{$date},{$time},{$arv},{$eelroad},{$pohiroad},{$jarelroad});") or die($db->error()); // once saved, redirect back to the view page header("Location: success.html");
<?php include dirname(__FILE__) . '/../Validate.php'; include dirname(__FILE__) . '/../Db.php'; if (!empty($_POST)) { $db = new Db(); $tituloCorto = !empty($_POST['tituloCorto']) ? $_POST['tituloCorto'] : ""; $orden = !empty($_POST['orden']) ? $_POST['orden'] : 0; $tituloLargo = !empty($_POST['tituloLargo']) ? $_POST['tituloLargo'] : ""; $info = !empty($_POST['info']) ? $_POST['info'] : ""; $db->query("INSERT INTO `proyectos` (`tituloCorto`,`orden`,`tituloLargo`,`info`) \n\t\tVALUES (" . $db->quote($tituloCorto) . ",\n\t\t" . $orden . ",\n\t\t" . $db->quote($tituloLargo) . ",\n\t\t" . $db->quote($info) . ")"); header("Location: index.php"); } ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <link href="../../css/bootstrap.min.css" rel="stylesheet"> <link href="../../css/backend.css" rel="stylesheet"> <script src="../../owl-carousel/jquery-1.9.1.min.js"></script> <script src="../../js/vendor/bootstrap.min.js"></script> <style type="text/css"> .inputText{ width: 40em; } </style> </head> <body>
$imagenError = null; $validate = new Validate(); $db = new Db(); if (!empty($_GET['id'])) { $id = $_REQUEST['id']; } else { header("Location: index.php"); } if (!empty($_POST)) { $file = $_FILES["imagen"]; $proyecto = !empty($_POST['proyecto']) ? $_POST['proyecto'] : "--"; $orden = !empty($_POST['orden']) ? $_POST['orden'] : 0; $fileName = preg_replace("/[^a-zA-Z0-9.]/", "", basename($file["name"])); if (!$validate->isFileEmpty($file)) { if ($validate->validateFile($file)) { $db->query("UPDATE slidersproyectos set imagen = " . $db->quote($fileName) . ", idproyecto = " . $db->quote($proyecto) . ", orden = " . $orden . " WHERE id = " . $id); header("Location: index.php"); } else { $imagenError = $validate->getFileError(); } } else { $result = $db->query("UPDATE slidersproyectos set orden = " . $orden . ", idproyecto = " . $db->quote($proyecto) . " WHERE id = " . $id); header("Location: index.php"); } } $rows = $db->select("SELECT * FROM slidersproyectos where id = " . $id); $imagen = $rows[0]["imagen"]; $idproyecto = $rows[0]["idproyecto"]; $orden = $rows[0]["orden"]; ?>
<?php include dirname(__FILE__) . '/../Validate.php'; include dirname(__FILE__) . '/../Db.php'; if (!empty($_POST)) { $db = new Db(); $validate = new Validate(); $imagenError = null; $file = $_FILES["imagen"]; $url = !empty($_POST['url']) ? $_POST['url'] : "#"; $orden = !empty($_POST['orden']) ? $_POST['orden'] : 0; $fileName = preg_replace("/[^a-zA-Z0-9.]/", "", basename($file["name"])); if (!$validate->isFileEmpty($file)) { if ($validate->validateFile($file)) { $db->query("INSERT INTO `clientes` (`imagen`,`orden`,`url`) \n\t\t\t\tVALUES (" . $db->quote($fileName) . "," . $orden . "," . $db->quote($url) . ")"); header("Location: index.php"); } else { $imagenError = $validate->getFileError(); } } else { $imagenError = "Debe adjuntar una imagen"; } } ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <link href="../../css/bootstrap.min.css" rel="stylesheet"> <link href="../../css/backend.css" rel="stylesheet">
public function isImageExist() { $db = new Db(); $id = $db->quote($this->menu_id); $query = "SELECT image FROM " . $this->tableName() . " WHERE id={$id}"; $result = $db->select($query); if (isset($result[0]) && count($result[0]) > 0) { // if(strlen($result[0]["image"]) > 0){ // unlink(WEB_FOLDER.MENU_IMG_FOLDER."/".$result[0]["image"]); // // } } return true; }
include dirname(__FILE__) . '/../Db.php'; include dirname(__FILE__) . '/../Validate.php'; $id = null; $validate = new Validate(); $db = new Db(); if (!empty($_GET['id'])) { $id = $_REQUEST['id']; } else { header("Location: index.php"); } if (!empty($_POST)) { $tituloCorto = !empty($_POST['tituloCorto']) ? $_POST['tituloCorto'] : ""; $orden = !empty($_POST['orden']) ? $_POST['orden'] : 0; $tituloLargo = !empty($_POST['tituloLargo']) ? $_POST['tituloLargo'] : ""; $info = !empty($_POST['info']) ? $_POST['info'] : ""; $result = $db->query("UPDATE proyectos set \n tituloCorto = " . $db->quote($tituloCorto) . ",\n orden = " . $orden . ",\n tituloLargo = " . $db->quote($tituloLargo) . ",\n info = " . $db->quote($info) . "\n WHERE id = " . $id); header("Location: index.php"); } $rows = $db->select("SELECT * FROM proyectos where id = " . $id); $tituloCorto = $rows[0]["tituloCorto"]; $orden = $rows[0]["orden"]; $tituloLargo = $rows[0]["tituloLargo"]; $info = $rows[0]["info"]; ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <link href="../../css/bootstrap.min.css" rel="stylesheet"> <link href="../../css/backend.css" rel="stylesheet">
public function save() { if (is_numeric($this->page_id) && is_string($this->page_name)) { $db = new Db(); $id = $db->quote($this->page_id); $category_id = $db->quote($this->category_id); $name = $db->quote($this->page_name); $url = $db->quote($this->url); $top_description = $db->quote($this->top_description); $bottem_description = $db->quote($this->bottom_description); $keyword = $db->quote($this->keyword); $title = $db->quote($this->title); $description = $db->quote($this->description); $access_type = $db->quote($this->access_type); $active = $db->quote($this->page_status); $author = $db->quote(1); $modified = $db->quote(1); $query = "INSERT INTO " . $this->tableName() . " (page_id, category_id, name, url, top_description, bottem_description, \n Keyword, title, description, author, modified_by, access_type, active) \n VALUES({$id}, {$category_id}, {$name}, {$url}, {$top_description}, {$bottem_description}, {$keyword}, {$title}, {$description},\n {$author}, {$modified}, {$access_type}, {$active})\n ON DUPLICATE KEY UPDATE \n name= {$name}, category_id={$category_id}, url={$url},top_description={$top_description}, bottem_description={$bottem_description}, \n Keyword={$keyword}, title={$title}, description={$description}, author={$author}, modified_by={$modified}, \n active={$active}, access_type={$access_type}"; if ($db->query($query)) { if ($db->affectedRows()) { return true; } } } return false; }
public function join($alias_from, $rel_name, $alias_to_nr, $conditions = array()) { $alias_to = 't' . $alias_to_nr; $alias_through = array($this->table_through, $alias_to . '_through'); $alias_to_table = array(call_user_func(array($this->model_to, 'table')), $alias_to); $models = array($rel_name . '_through' => array('model' => null, 'connection' => call_user_func(array($this->model_to, 'connection')), 'table' => $alias_through, 'primary_key' => null, 'join_type' => \Arr::get($conditions, 'join_type') ?: \Arr::get($this->conditions, 'join_type', 'left'), 'join_on' => array(), 'columns' => $this->select_through($alias_to . '_through'), 'rel_name' => $this->model_through, 'relation' => $this), $rel_name => array('model' => $this->model_to, 'connection' => call_user_func(array($this->model_to, 'connection')), 'table' => $alias_to_table, 'primary_key' => call_user_func(array($this->model_to, 'primary_key')), 'join_type' => \Arr::get($conditions, 'join_type') ?: \Arr::get($this->conditions, 'join_type', 'left'), 'join_on' => array(), 'columns' => $this->select($alias_to), 'rel_name' => strpos($rel_name, '.') ? substr($rel_name, strrpos($rel_name, '.') + 1) : $rel_name, 'relation' => $this, 'where' => \Arr::get($conditions, 'where', array()))); reset($this->key_from); foreach ($this->key_through_from as $key) { $models[$rel_name . '_through']['join_on'][] = array($alias_from . '.' . current($this->key_from), '=', $alias_to . '_through.' . $key); next($this->key_from); } reset($this->key_to); foreach ($this->key_through_to as $key) { $models[$rel_name]['join_on'][] = array($alias_to . '_through.' . $key, '=', $alias_to . '.' . current($this->key_to)); next($this->key_to); } foreach (array(\Arr::get($this->conditions, 'where', array()), \Arr::get($conditions, 'join_on', array())) as $c) { foreach ($c as $key => $condition) { !is_array($condition) and $condition = array($key, '=', $condition); if (!$condition[0] instanceof \Fuel\Core\Database_Expression and strpos($condition[0], '.') === false) { $condition[0] = $alias_to . '.' . $condition[0]; } is_string($condition[2]) and $condition[2] = \Db::quote($condition[2], $models[$rel_name]['connection']); $models[$rel_name]['join_on'][] = $condition; } } $order_by = \Arr::get($conditions, 'order_by') ?: \Arr::get($this->conditions, 'order_by', array()); foreach ($order_by as $key => $direction) { if (!$key instanceof \Fuel\Core\Database_Expression and strpos($key, '.') === false) { $key = $alias_to . '.' . $key; } else { $key = str_replace(array($alias_through[0], $alias_to_table[0]), array($alias_through[1], $alias_to_table[1]), $key); } $models[$rel_name]['order_by'][$key] = $direction; } return $models; }
include dirname(__FILE__) . '/../Validate.php'; include dirname(__FILE__) . '/../Db.php'; if (!empty($_POST)) { $db = new Db(); $validate = new Validate(); $imagenError = null; $file = $_FILES["imagen"]; $nombre = !empty($_POST['nombre']) ? $_POST['nombre'] : ""; $cargo = !empty($_POST['cargo']) ? $_POST['cargo'] : ""; $correo = !empty($_POST['correo']) ? $_POST['correo'] : ""; $info = !empty($_POST['info']) ? $_POST['info'] : ""; $orden = !empty($_POST['orden']) ? $_POST['orden'] : 0; $fileName = preg_replace("/[^a-zA-Z0-9.]/", "", basename($file["name"])); if (!$validate->isFileEmpty($file)) { if ($validate->validateFile($file)) { $db->query("INSERT INTO `nosotros` (`nombre`,`cargo`,`correo`,`info`,`imagen`,`orden`) \n\t\t\t\tVALUES (" . $db->quote($nombre) . ",\n\t\t\t\t" . $db->quote($cargo) . ",\n\t\t\t\t" . $db->quote($correo) . ",\n\t\t\t\t" . $db->quote($info) . ",\n\t\t\t\t" . $db->quote($fileName) . ",\n\t\t\t\t" . $orden . ")"); header("Location: index.php"); } else { $imagenError = $validate->getFileError(); } } else { $imagenError = "Debe adjuntar una imagen"; } } ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <link href="../../css/bootstrap.min.css" rel="stylesheet">
public function delete($arg) { $db = new Db(); $vid = $db->quote($arg); $results = $db->query("DELETE from vehicles where vehicleID = {$vid}"); }