本文整理汇总了PHP中MySQL::query方法的典型用法代码示例。如果您正苦于以下问题:PHP MySQL::query方法的具体用法?PHP MySQL::query怎么用?PHP MySQL::query使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MySQL
的用法示例。
在下文中一共展示了MySQL::query方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setNotification
static function setNotification($bookingId, $oneWeek, $threeDays, $oneDay)
{
$mysql = new MySQL();
if (self::getNotification($bookingId) === null) {
$results = $mysql->query('INSERT INTO notification(booking_id, one_week, three_days, one_day) VALUES (:booking_id, :one_week, :three_days, :one_day)', [':booking_id' => $bookingId, ':one_week' => $oneWeek, ':three_days' => $threeDays, ':one_day' => $oneDay]);
} else {
$results = $mysql->query('UPDATE notification SET one_week = :one_week, three_days = :three_days, one_day = :one_day WHERE booking_id = :booking_id', [':booking_id' => $bookingId, ':one_week' => $oneWeek, ':three_days' => $threeDays, ':one_day' => $oneDay]);
}
return $results['success'];
}
示例2: setKey
/**
* Добавить ключ если он не сущетсует или изменить его значение
*
* @param mixed $key
* @param string $value
*/
public static function setKey($key, $value)
{
$value = serialize($value);
self::dbConnector();
try {
self::$_sql->query("INSERT INTO `REGISTRY` VALUES ('{$key}','{$value}')");
} catch (Exception $ex) {
self::$_sql->query("UPDATE `REGISTRY` SET `value_serealized`='{$value}' WHERE `key`='{$key}'");
}
}
示例3: checkNeededDataGoogleSearchAnalytics
/**
* Query database. Retrun all values from a table
*
* @param $table String Table name
*
* @returns Object Database records. MySQL object
*/
public function checkNeededDataGoogleSearchAnalytics($website)
{
$core = new Core();
//Load core
$mysql = new MySQL();
//Load MySQL
$now = $core->now();
/* Identify date range */
$dateStartOffset = self::GOOGLE_SEARCH_ANALYTICS_MAX_DATE_OFFSET + self::GOOGLE_SEARCH_ANALYTICS_MAX_DAYS;
$dateStart = date('Y-m-d', strtotime('-' . $dateStartOffset . ' days', $now));
$dateEnd = date('Y-m-d', strtotime('-' . self::GOOGLE_SEARCH_ANALYTICS_MAX_DATE_OFFSET . ' days', $now));
/* Query database for dates with data */
$query = "SELECT COUNT( DISTINCT date ) AS record, date FROM " . MySQL::DB_TABLE_SEARCH_ANALYTICS . " WHERE domain LIKE '" . $website . "' AND date >= '" . $dateStart . "' AND date <= '" . $dateEnd . "' GROUP BY date";
$result = $mysql->query($query);
/* Create array from database response */
$datesWithData = array();
foreach ($result as $row) {
array_push($datesWithData, $row['date']);
}
/* Get date rante */
$dates = $core->getDateRangeArray($dateStart, $dateEnd);
/* Loop through dates, removing those with data */
foreach ($dates as $index => $date) {
if (in_array($date, $datesWithData)) {
unset($dates[$index]);
}
}
/* Reindex dates array */
$dates = array_values($dates);
$returnArray = array('dateStart' => $dateStart, 'dateEnd' => $dateEnd, 'datesWithNoData' => $dates);
return $returnArray;
}
示例4: testTemplateType
private static function testTemplateType()
{
if (self::$clanData['premiumBis'] < time()) {
if (!empty(self::$clanData['useStandartDesign'])) {
echo "Eigenes Standart Design ";
} else {
Template::init("templates/standart_stylecheet.css");
Template::replace("{header_height}", self::$clanData['designset_headerheight']);
Template::set("Content-Type: text/css");
echo Template::out();
}
} else {
MySQL::query("SELECT * FROM `inhalte` WHERE `template`='1' AND `templateType`='5'");
if (MySQL::count()) {
MySQL::query("SELECT * FROM `inhalte` WHERE `template`='1' AND `templateType`='6'");
if (MySQL::count()) {
$row = MySQL::fetchArray();
Template::init(NULL, true, $row['inhalt']);
Template::replace("{header_height}", self::$clanData['designset_headerheight']);
Template::set("Content-Type: text/css");
echo Template::out();
}
} else {
echo "Premium Standart";
}
}
}
示例5: testTemplateType
private static function testTemplateType()
{
if (self::$clanData['data']['premiumBis'] < time()) {
if (!empty(self::$clanData['data']['useStandartDesign'])) {
echo "Eigenes Standart Design ";
} else {
Template::init("templates/standart.html");
Template::replace("</head>", "\n" . Template::leerzeichen("<title>") . '<link rel="stylesheet" type="text/css" href="http://myclankonto.net/' . self::$routerData['clanid'] . '/stylecheet.css" />' . "\n" . Template::leerzeichen("<head>") . '</head>');
Template::replaceContent("{seiteninhalt}", "pages/site/" . self::$routerData['site'] . ".php");
Template::replace("{title}", self::$clanData['data']['pageTitle']);
echo Template::out();
}
} else {
MySQL::query("SELECT * FROM `inhalte` WHERE `clanid`='" . self::$routerData['clanid'] . "' AND `template`='1' AND `templateType`='5'");
if (MySQL::count() == 1) {
$row = MySQL::fetchArray();
Template::init(NULL, true, $row['inhalt']);
MySQL::query("SELECT * FROM `inhalte` WHERE `template`='1' AND `templateType`='6'");
if (MySQL::count()) {
Template::replace("</head>", "\n" . Template::leerzeichen("<title>") . '<link rel="stylesheet" type="text/css" href="http://myclankonto.net/' . self::$routerData['clanid'] . '/stylecheet.css" />' . "\n" . Template::leerzeichen("<head>") . '</head>');
}
Template::replaceContent("{seiteninhalt}", "pages/site/" . self::$routerData['site'] . ".php");
Template::replace("{title}", self::$clanData['data']['pageTitle']);
echo Template::out();
} else {
echo "Premium Standart";
}
}
}
示例6: createEntity
public static function createEntity($identifier, $friendlyname, $lat, $lon)
{
$db = new MySQL();
$sql = 'INSERT INTO entities ';
$sql .= '(`ID`, `IDENTIFIER`, `FRIENDLYNAME`, `LATITUDE`, `LONGITUDE`, `DATETIME`, `DETACHED`) ';
$sql .= 'VALUES (\'\', %s, %s, %s, %s, NOW(), 0);';
return $db->query($sql, $identifier, $friendlyname, $lat, $lon);
}
示例7: getRating
/**
* Get a specific rating
*
* @param $offerId
* @param $userId
* @return null
*/
static function getRating($offerId, $userId)
{
$mysql = new MySQL();
$results = $mysql->query('SELECT * FROM rating WHERE offer = :offer AND createdby = :createdby', [':offer' => $offerId, ':createdby' => $userId]);
if ($results['success'] == true && !empty($results['results']) && $results['results'] != null) {
return $results['results'];
}
return null;
}
示例8: createNonAttendance
/**
* Creates a non attendance record for a booking id
*
* @param $bookingId
* @param $workshopId
* @return bool
*/
public static function createNonAttendance($bookingId, $workshopId)
{
if (self::getAttendance($bookingId) != null) {
return false;
}
$mysql = new MySQL();
$results = $mysql->query('INSERT INTO attendance(booking_id, workshop_id, student_id, attendance, learnt, taught, datecompleted) VALUES (:booking_id, :workshop_id, :student_id, :attendance, :learnt, :taught, :datecompleted)', [':booking_id' => $bookingId, ':workshop_id' => $workshopId, ':student_id' => User::getId(), ':attendance' => 0, ':learnt' => 'DID NOT ATTEND', ':taught' => 'DID NOT ATTEND', ':datecompleted' => time()]);
if ($results['success']) {
return true;
}
return false;
}
示例9: getSiteData
public static function getSiteData($siteId = NULL)
{
if ($siteId == NULL) {
throw new Exeption("siteData::getSiteData() haven't become an Siteid.");
} else {
MySQL::query("SELECT * FROM `webseiten` WHERE `clanid`='" . $siteId . "'");
if (MySQL::count() != 1) {
return array("success" => false, "error" => "Die Webseite mit der ID " . $siteId . " existiert nicht.");
} else {
return array("success" => true, "data" => MySQL::fetchArray());
}
}
}
示例10: getSubSection
/**
* Получает список дочерних разделов с учётом поля show_sub таблицы URL
*
* @return Array
*/
public function getSubSection()
{
$r = $this->_sql->query("SELECT `link`,`title` FROM `URL` WHERE `pid`={$this->_currentID} AND `module`!=0");
$t = $this->_sql->GetRows($r);
$bitOfString = $this->url = substr($_SERVER['REQUEST_URI'], 1);
$resArr = NULL;
if ($t != NULL) {
foreach ($t as $value) {
$resArr[] = array("link" => $value["link"] = "/" . $bitOfString . $value["link"] . "/", "title" => $value["title"]);
}
}
return $resArr;
}
示例11: del
function del($src, $dst)
{
$mysql = new MySQL();
$mysql->opendb("dns_http_ref", "utf8");
#$sql = "update `http_ref` set `status` = 'false' where `dst`='$dst' and `src`='$src'";
$sql = "delete from `http_ref` where `dst`='{$dst}' and `src`='{$src}'";
$result = $mysql->query($sql);
if ($result) {
$ret = 0;
} else {
$ret = 1;
}
print_r(json_encode(result_init($ret, '', '')));
}
示例12: update
public function update($record_id)
{
if (empty($db)) {
$dbConnection = new dbConnection();
$db = new MySQL($dbConnection->host, $dbConnection->userdb, $dbConnection->pass, $dbConnection->dbname);
}
$column_value_array = array_combine($this->my_columns_array, $this->my_values_array);
$update_string = '';
foreach ($column_value_array as $column => $value) {
$value = strip_tags(mysqli_real_escape_string($db->dbConn, $value));
$update_string .= $column . "='" . $value . "',";
}
$update_string = trim($update_string, ",");
$sql = "UPDATE " . $this->my_table . " SET {$update_string} WHERE " . $this->my_table . "_id = {$record_id}";
$results = $db->query($sql);
return TRUE;
}
示例13: t
function t($str)
{
global $CONF;
//if in maintainance mode, record this string in the translation db
if ($CONF['maintainer_mode']) {
require_once 'pastebin/mysql.class.php';
$db = new MySQL();
$db->query("select * from original_phrase where original=?", $str);
if ($db->next_record()) {
//update timestamp
$original_phrase_id = $db->f('original_phrase_id');
$db->query("update original_phrase set used=now() where original_phrase_id={$original_phrase_id}");
} else {
//create new record
$db->query("insert into original_phrase(original,used) values (?, now())", $str);
}
}
//if using english ui, just return the string
//if a translation is available, use that
//otherwise, use english
return $str;
}
示例14: initCheck
public static function initCheck($domain = "myclankonto.net", $did = 1)
{
$subdomain = $_SERVER['HTTP_HOST'];
$subdomain = preg_replace("/\\." . $domain . "/Usi", "", $subdomain);
$subdomain = preg_replace("/www\\./Usi", "", $subdomain);
$subdomain = strtolower($subdomain);
if ($subdomain != $domain) {
MySQL::query("SELECT * FROM `subdomains` WHERE `domainID`='" . $did . "' AND `host`='" . $subdomain . "'");
if (MySQL::count() == 0) {
echo "null mysql";
die;
} else {
$row = MySQL::fetchArray();
if ($row['status']) {
header("Location: http://myclankonto.net/" . $row['clanid'] . "/site/intro/");
die;
} else {
echo "pff";
die;
}
}
}
}
示例15: Ocarina
// Includo le classi principali
include_once "../core/class.Ocarina.php";
include_once "../core/class.MySQL.php";
include_once "../core/class.Functions.php";
include_once "../rendering/config.php";
// Istanzio le classi
$cms = new Ocarina();
$db = new MySQL();
$func = new Functions();
if (!isset($_GET['nickname']) and !isset($_POST['nickname'])) {
$text = '<form action="" method="post">
Utente:<br /><select name="nickname">';
// Mi connetto al database
$db->connettidb();
// Creo una select con tutte le categorie
$query = $db->query("SELECT nickname FROM utenti");
while ($riga = $db->estrai($query)) {
$text .= '<option value="' . $func->rescape($riga->nickname) . '">' . $func->rescape($riga->nickname) . '</option>';
}
// Mi disconnetto dal database
$db->disconnettidb();
$text .= '</select><input type="submit" name="submit" value="Accedi">
</form>';
$nickname = 'Profilo';
// Per il titolo della pagina
} elseif (isset($_GET['nickname']) or isset($_POST['nickname'])) {
// Prelevo il nickname
if ($_GET['nickname']) {
$nickname = $func->escape($_GET['nickname']);
} elseif ($_POST['nickname']) {
$nickname = $func->escape($_POST['nickname']);