本文整理汇总了PHP中Db::quote方法的典型用法代码示例。如果您正苦于以下问题:PHP Db::quote方法的具体用法?PHP Db::quote怎么用?PHP Db::quote使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Db
的用法示例。
在下文中一共展示了Db::quote方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: SaveLocation
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;
}
示例2: addcompany
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;
}
示例3: save
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;
}
示例4: addquestion
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;
}
}
}
示例5: save
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;
}
示例6: save
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;
}
示例7: save
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;
}
示例8: delete
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}");
}
示例9: getName
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;
}
示例10: getPageTypeUrl
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 "";
}
示例11: SaveWeatherData
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;
}
示例12: insert
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;
}
}
示例13: getDocumentType
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";
}
示例14: save
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;
}
示例15: GetSoil
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;
}