本文整理汇总了PHP中querySQL函数的典型用法代码示例。如果您正苦于以下问题:PHP querySQL函数的具体用法?PHP querySQL怎么用?PHP querySQL使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了querySQL函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: GetFileDir
<?php
// Get global file path
function GetFileDir($php_self)
{
$filename2 = '';
$filename = explode("/", $php_self);
// THIS WILL BREAK DOWN THE PATH INTO AN ARRAY
for ($i = 0; $i < count($filename) - 2; ++$i) {
$filename2 .= $filename[$i] . '/';
}
return $filename2;
}
// General settings per resort from database
$general = array();
$general = querySQL('settings_inc');
if ($_SESSION['valid_user'] == TRUE) {
$_SESSION['language'] = $general['language'];
}
// Set default timezone in PHP 5.
if (function_exists('date_default_timezone_set')) {
date_default_timezone_set($general['timezone']);
}
/* Set PHP local */
setlocale(LC_TIME, $general['language']);
/* Set global base path */
$global_basedir = '';
if (isset($_SERVER['HTTPS'])) {
$global_basedir = 'https://';
} else {
$global_basedir = 'http://';
示例2: querySQL
if ($_SESSION['page'] == 1) {
$reservations = querySQL('all_reservations');
} else {
$reservations = querySQL('reservations');
}
if ($reservations) {
// reset total counters
$tablesum = 0;
$guestsum = 0;
//start printing out reservation grid
foreach ($reservations as $row) {
// reservation ID
$id = $row->reservation_id;
$_SESSION['reservation_guest_name'] = $row->reservation_guest_name;
// check if reservation is tautologous
$tautologous = querySQL('tautologous');
echo "<tr id='res-" . $id . "'>";
echo "<td";
// reservation after maitre message
if ($row->reservation_timestamp > $maitre['maitre_timestamp'] && $maitre['maitre_comment_day'] != '') {
echo " class='tautologous' title='" . _sentence_13 . "' ";
}
echo ">";
// old reservations symbol
if (strtotime($row->reservation_timestamp) + $general['old_days'] * 86400 <= time()) {
echo "<img src='images/icons/clock-bolt.png' class='help tipsyold middle smicon' title='" . _sentence_11 . "' />";
} else {
// daylight coloring
if ($row->reservation_time > $daylight_evening) {
echo "<img src='images/icons/clock-moon.png' class='middle smicon'/>";
} else {
示例3: executeSQL
executeSQL($conn, $sql);
$sql = "\n\t\t\t\t\t\tupdate tbl_user a,\n\t\t\t\t\t\t(\n\t\t\t\t\t\tselect a.userid, a.macid\n\t\t\t\t\t\tfrom tbl_user_macid a,\n\t\t\t\t\t\t(select userid, max(update_date) as update_date from tbl_user_macid where delete_flag=0 group by userid) b\n\t\t\t\t\t\twhere a.delete_flag=0 and a.userid=b.userid and a.update_date=b.update_date\n\t\t\t\t\t\t) b\n\t\t\t\t\t\tset a.macid = b.macid\n\t\t\t\t\t\twhere a.id = b.userid and a.id=" . correctSQL($old_uid);
executeSQL($conn, $sql);
}
// set macid
$sql = "insert into tbl_user_macid (userid, macid, create_id, create_date, update_id, update_date)\n\t\t\t\t\t\t\t\tVALUES('" . toStringForSql($uid) . "', '" . toStringForSql($macid) . "', '" . toStringForSql($userid) . "', now(), '" . toStringForSql($userid) . "', now())";
executeSQL($conn, $sql);
$sql = "update tbl_user set macid='" . toStringForSql($macid) . "' where id='" . toStringForSql($uid) . "'";
executeSQL($conn, $sql);
}
// activate online payment
if ($activation == 1) {
$sql = "update tbl_user set activation=0 where id='" . toStringForSql($uid) . "'";
executeSQL($conn, $sql);
$sql = "select userid, serviceid, start_date, end_date from tbl_user_status where userid='" . toStringForSql($uid) . "' and delete_flag=0";
$result = querySQL($conn, $sql);
$row = mysql_fetch_array($result);
$start_date = $row["start_date"];
$now = date("Y-m-d");
$end_date = $row["end_date"];
$days = ceil((strtotime($now) - strtotime($start_date)) / (60 * 60 * 24));
$y = intval(substr($start_date, 0, 4));
$m = intval(substr($start_date, 5, 2));
$d = intval(substr($start_date, 8, 2));
$start_date = date('Y-m-d', mktime(0, 0, 0, $m, $d + $days, $y));
$y = intval(substr($end_date, 0, 4));
$m = intval(substr($end_date, 5, 2));
$d = intval(substr($end_date, 8, 2));
$end_date = date('Y-m-d', mktime(0, 0, 0, $m, $d + $days, $y));
$sql = 'update tbl_user_status' . ' set start_date=' . correctSQL(substr($start_date, 0, 10)) . ' , end_date=' . correctSQL(substr($end_date, 0, 10)) . ' where userid=' . $uid . ' and delete_flag=0';
executeSQL($conn, $sql);
示例4:
<?
$events = querySQL('db_propery_events');
if ($events) {
// remember original session outlet id
$mem_id = $_SESSION['outletID'];
foreach($events as $row) {
$_SESSION['outletID'] = $row->outlet_id;
echo "<tr id='events-".$row->id."'>";
echo "<td><span class='bold'>".date($general['dateformat'],strtotime($row->event_date))."</strong></td>
<td><span class='bold'><a href='?p=6&q=4&btn=3&eventID=".$row->id."'>".$row->subject."</a></strong>
<a href='main_page.php?p=2&outletID=".$row->outlet_id."&selectedDate=".$row->event_date."' style='margin-left:12px;'>
<img src='images/icons/arrow.png'/></a>
</td>
<td>".querySQL('db_outlet')."</td>
<td>".formatTime($row->start_time,$general['timeformat'])."</td>
<td>".formatTime($row->end_time,$general['timeformat'])."</td>";
//<td>".$row->open_to."</td>
//<td><small>".$row->contact."</small></td>
echo "<td>".$row->advertise_start." "._days." "._before."</td>
<td>".number_format($row->price,2)."</td>
<td>
<a href='#modaldelete' name='events' id='".$row->id."' class='deletebtn'>
<img src='images/icons/delete_cross.png' alt='"._cancelled."' class='help' title='"._delete."'/>
</a>
</td>
</tr>";
}
//get back original session outlet id
$_SESSION['outletID'] = $mem_id;
示例5: FROM
<?php
require_once 'functions.php';
$tempEmail = $_POST['email'];
$tempUser = $_POST['user'];
$tempNewPass = $_POST['newPass'];
$sql = "SELECT * FROM (solitaire) WHERE (email) LIKE ('{$tempEmail}') AND (user) LIKE ('{$tempUser}')";
$result = querySQL($sql);
if (odbc_fetch_row($result) == false) {
echo "Email or username does not exist.";
} else {
$sql = "UPDATE (solitaire) SET password='{$tempNewPass}' WHERE user='{$tempUser}'";
$result = querySQL($sql);
}
示例6: querySQL
$history = querySQL('reservation_history');
echo "<label>" . _visits . "</label><p>" . $visits . "</p>";
echo "<label>" . _last_visit . "</label><p>" . $lastvisit . "</p>";
echo "<label>" . _history . "</label>";
echo "<p><ul class='global'>";
if (count($history) > 0) {
foreach ($history as $row) {
if (trim($row->reservation_notes) != '') {
echo "<li>" . $row->reservation_notes . "</li>";
}
}
}
echo "</ul></p>";
//reservation history
echo "<br/><label>" . _changes . "</label><p><div class='option_xl'><div class='text'></div>";
$res_history = querySQL('res_history');
echo "<select name='history' size='1' >\n";
foreach ($res_history as $row) {
echo "<option>" . $row->author . " : " . $row->timestamp . "</option>";
}
echo "</select></div></p><br/>";
?>
</div>
</div>
</div>
<?php
}
?>
<br/>
<br style='clear:both;'/>
</div>
示例7: querySQL
$row->subject."</a> | ".$row->outlet_name."</span>
<p>".$row->description."</p><p><cite><span class='bold'>
".date($general['dateformat'],strtotime($row->event_date)).
"</span> ".formatTime($row->start_time,$general['timeformat']).
" - ".formatTime($row->end_time,$general['timeformat'])." | ".
_ticket_price.": ".number_format($row->price,2).
"</cite></p>";
if( key($row) != count($events_advertise)-1 ) {
echo"<br/>";
}
}
echo "</div>";
}
// Special event of the day and outlet
$special_events = querySQL('event_data_day');
if ($special_events && $_SESSION['page'] == 2 ) {
echo "<div class='alert_info'>";
// special events
foreach($special_events as $row) {
echo "
<img src='../web/images/icon_cutlery.png' alt='special' class='middle'/>
<span class='bold'>
<a href='".$_SERVER['SCRIPT_NAME']."?outletID=".$row->outlet_id."&selectedDate=".$row->event_date."'>".
_today.": ".$row->subject."</a></span>
<p class='margin-bottom-10'>".$row->description."</p><p><cite>
".date($general['dateformat'],strtotime($row->event_date)).
" ".formatTime($row->start_time,$general['timeformat']).
" - ".formatTime($row->end_time,$general['timeformat'])." | ".
_ticket_price.": ".number_format($row->price,2).
"</cite></p>";
示例8: secureSuperGlobals
<?php
/* Connection to Database */
// ** set configuration
include '../../config/config.general.php';
// ** database functions
include '../classes/database.class.php';
// ** connect to database
include '../classes/connect.db.php';
// ** all database queries
include '../classes/db_queries.db.php';
if ($_POST['cellid']) {
// prevent dangerous input
secureSuperGlobals();
$value = $_POST['action'] == 'enable' ? '1' : '0';
$id = (int) $_POST['cellid'];
if (isset($id)) {
$sql = querySQL('user_activate');
echo $sql;
} else {
echo "AJAX Error";
}
}
示例9: isset
// 2 = secondseating
$_SESSION['wait'] = $_GET['w'] ? (int) $_GET['w'] : 0;
// selected button
if (isset($_GET['btn'])) {
$_SESSION['button'] = (int) $_GET['btn'];
} else {
if (empty($_SESSION['button'])) {
$_SESSION['button'] = 1;
}
}
// reservation detail edit
if (isset($_GET['resedit'])) {
if ($_GET['resedit'] == 1) {
$resedit = 'ON';
}
} else {
$resedit = 'OFF';
}
// package code
$_SESSION['pk_code'] = isset($_GET['pk']) ? $_GET['pk'] : 'CXL';
// searchquery
$searchquery = '';
if (isset($_POST['searchquery'])) {
$searchquery = $_POST['searchquery'] . "%";
$q = 4;
}
// Last ID of reservation table for ajax realtime updates
$_SESSION['max_id'] = querySQL('max_id');
?>
示例10: getCurrentTVGuide
function getCurrentTVGuide($conn, $channels)
{
$sql = "\n\t\tSELECT * FROM (\n\t\t\tSELECT b.channel_hashid AS id, a.program_time AS program_time, a.title AS title \n\t\t\tFROM tbl_channel_program a, tbl_channel b\n\t\t\tWHERE b.channel_hashid in (" . toStringForSql($channels) . ")'\n\t\t\tAND\t\ta.channelid = b.channelid\n\t\t\tAND\t\tprogram_time <= NOW()\n\t\t\tORDER BY b.channel_hashid ASC , a.program_time DESC\n\t\t\tLIMIT 1\n\t\t) A\n\t\tUNION ALL\n\t\tSELECT * FROM (\n\t\t\tSELECT b.channel_hashid AS id, a.program_time AS program_time, a.title AS title \n\t\t\tFROM tbl_channel_program a, tbl_channel b\n\t\t\tWHERE b.channel_hashid in (" . toStringForSql($channels) . ")'\n\t\t\tAND\t\ta.channelid = b.channelid\n\t\t\tAND\t\tprogram_time > NOW()\n\t\t\tORDER BY b.channel_hashid ASC , a.program_time ASC\n\t\t\tLIMIT 5\n\t\t) B\n\t\t";
$result = querySQL($conn, $sql);
return $result;
}
示例11: com_install
/**
* Executes additional installation processes
*
* @since 0.1
*/
function com_install()
{
$result = true;
//global $mainframe;
$db =& JFactory::getDBO();
$installer =& JInstaller::getInstance();
$dbOrdner = $installer->getPath('extension_administrator') . DS . 'db' . DS;
$filename = $dbOrdner . 'install.sql';
if (!file_exists($filename)) {
JError::raiseWarning(1, 'SQL install file (' . $filename . ') does not exist.');
return false;
}
$file_content = file_get_contents($filename);
$db->setQuery("SELECT value FROM #__fussball_infos WHERE name = 'db_version'");
$db_version = $db->loadResult();
if (isset($db_version)) {
// Wenn schon eine Datenbank vorhanden ist, Versionen vergleichen
$newVersion = getVersion($file_content);
if ($db_version == $newVersion) {
logge('Die vorhanden Datenbanktabellen der Version ' . $newVersion . ' werden verwendet.');
} else {
$updateFilename = $dbOrdner . 'update' . $db_version . 'to' . $newVersion . '.sql';
if (file_exists($updateFilename)) {
if (querySQL(file_get_contents($updateFilename))) {
logge('Die Datenbank wurde auf die Version ' . $newVersion . ' geupdated.');
} else {
logge('Beim Update der Datenbank von Version ' . $db_version . ' auf Version ' . $newVersion . ' trat ein Fehler auf.', false);
$result = false;
}
} else {
logge('Es ist kein Update-Skript (' . $updateFilename . ') für die Datenbank vorhanden.', false);
$result = false;
}
}
} else {
// Wenn die Datenbank nicht vorhanden ist, diese anlegen
if (querySQL($file_content)) {
logge('Die Datenbanktabellen der Version ' . getVersion($file_content) . ' wurden installiert.');
} else {
logge('Es trat ein Fehler beim Anlegen der Datenbanktabellen der Version ' . getVersion($file_content) . '.', false);
$result = false;
}
}
if ($result) {
// $result = insertDefaultAttributes();
//if ($result) {
logge('Fussball Komponente wurde erfolgreich installiert.');
//}
} else {
//logge();
//print_r(JError::getErrors());
}
return $result;
}
示例12: while
}
echo "</tr></thead><tbody>";
$done = 1;
}
echo "<tr>";
echo "<td>" . $_SESSION['selOutlet']['outlet_name'] . "</td>";
$i = 0;
while ($i <= 6) {
// week day date
$_SESSION['statistic_week'] = date('Y-m-d', mktime(0, 0, 0, $sm, $sd + $i, $sy));
// noon
$value = $daylight_evening;
$row = querySQL('statistic_week_def_noon');
$statistic_noon = $row[0]->paxsum ? $row[0]->paxsum : 0;
// evening
$row = querySQL('statistic_week_def_evening');
$statistic_evening = $row[0]->paxsum ? $row[0]->paxsum : 0;
echo "<td><strong><a href='main_page.php?p=2&outletID=" . $_SESSION['selOutlet']['outlet_id'] . "&selectedDate=" . $_SESSION['statistic_week'] . "'>";
if ($statistic_noon == 0 && $statistic_evening == 0) {
echo "";
} else {
echo "<img src='images/icons/clock-sun.png' style='height:10px' class='middle'/>" . $statistic_noon;
echo "<img src='images/icons/clock-moon.png' style='height:10px' class='middle'/>" . $statistic_evening . "</a><strong></td>";
}
$i++;
}
echo "</tr>";
if ($done != 1) {
echo "</tbody>";
}
}
示例13: session_start
<?php
session_start();
$_SESSION['language'] = $_SESSION['language'] ? $_SESSION['language'] : 'en';
// Check for a unique username
// ** set configuration
include '../../config/config.general.php';
// ** database functions
include '../classes/database.class.php';
// ** connect to database
include '../classes/connect.db.php';
// ** all database queries
include '../classes/db_queries.db.php';
// ** localization functions
include '../classes/local.class.php';
// ** set configuration
include '../../config/config.inc.php';
// translate to selected language
translateSite(substr($_SESSION['language'], 0, 2), '../');
// prevent dangerous input
secureSuperGlobals();
if (isset($_POST['username'])) {
$value = $_POST['username'];
$sql_check = querySQL('check_username');
if (mysql_num_rows($sql_check)) {
echo '<span style="color: red;">' . _already_user_1 . ' <span class="bold">' . $value . '</span> ' . _already_user_2 . '</span>';
} else {
echo "OK";
}
}
示例14: getChannelOfService
function getChannelOfService($conn, $serviceid)
{
$sql = "\n\t\t\tselect \n\t\t\t\tsubstr(a.groupname, 3) as groupname, a.grouptype, \n\t\t\t\ta.id, a.channel_hashid, substr(a.name, 4) as name, a.image, a.piecelength,\n\t\t\t\tsubstr(a.groupname, 1, 1) as gorder,\n\t\t\t\tsubstr(a.name, 1, 2) as corder\n\t\t\tfrom \n\t\t\t\ttbl_channel a, tbl_service_channel b\n\t\t\twhere \n\t\t\t\ta.delete_flag=0 and b.delete_flag=0 and b.serviceid='" . toStringForSql($serviceid) . "' and a.id=b.channelid and a.status=1 and a.grouptype = 1\n\t\t\tunion all\n\t\t\tselect \n\t\t\t\tsubstr(a.groupname, 3) as groupname, a.grouptype, \n\t\t\t\ta.id, a.channel_hashid, substr(a.name, 6) as name, a.image, a.piecelength,\n\t\t\t\tsubstr(a.groupname, 1, 1) as gorder,\n\t\t\t\tsubstr(a.name, 1, 4) as corder\n\t\t\tfrom \n\t\t\t\ttbl_channel a\n\t\t\twhere \n\t\t\t\ta.delete_flag=0 and a.status=1 and a.grouptype = 2\n\t\t\torder by \n\t\t\t\tgrouptype, gorder, corder\n\t\t";
$result = querySQL($conn, $sql);
return $result;
}
示例15: secureSuperGlobals
secureSuperGlobals();
$_SESSION['confHash'] = $_GET['c'];
$errorMessage = "";
$validCount = 0;
//check confirmation hash with the database
$result = querySQL('check_confirm_code');
//print_r($result);
//$validCount = mysql_num_rows($result);
if ($result['active'] == 1) {
$errorMessage .= _errorMessage_all;
}
if (!$result) {
$errorMessage .= _errorMessage_no;
}
if (empty($errorMessage)) {
$result = querySQL('user_confirm_activate');
$errorMessage .= _errorMessage_yes;
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<!-- Website Title -->
<title>Account Activation</title>
<!-- Meta data for SEO -->
<meta name="description" content="An easy to use Restaurant Reservation System"/>
<meta name="keywords" content="Restaurant Reservation System, Restaurant, Hotel, Reservation"/>