本文整理汇总了PHP中doQuery函数的典型用法代码示例。如果您正苦于以下问题:PHP doQuery函数的具体用法?PHP doQuery怎么用?PHP doQuery使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了doQuery函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: db_error_logger
function db_error_logger($errno, $errstr, $errfile = "", $errline = "", $errorcontext = array()){
$errno = makeStringSafe($errno);
$errstr = makeStringSafe($errstr);
$errfile = makeStringSafe($errfile);
$errline = makeStringSafe($errline);
if($errno < E_STRICT){
doQuery("INSERT INTO ".getDBPrefix()."_error_log set user_id = '".getSessionVariable("user_id")."', error_number = '".$errno."',
message = '".$errstr."', file = '".$errfile."', line_number = '".$errline."', context = '".serialize($errorcontext)."',
time = '".getCurrentMySQLDateTime()."'");
$errorrow = mysql_fetch_assoc(doQuery("SELECT error_id FROM ".getDBPrefix()."_error_log ORDER BY error_id DESC LIMIT 1"));
if(getConfigVar('error_output') == ERROR_OUTPUT_DBID || getConfigVar('error_output') == ERROR_OUTPUT_BOTH){
echo "<h4 style=\"color: #FF0000;\">An error occured! If you would like to report this error, please report that your 'ERROR_ID' is '".$errorrow['error_id']."'.</h4>";
}
}
return !(getConfigVar("error_output") == ERROR_OUTPUT_PHP || getConfigVar("error_output") == ERROR_OUTPUT_BOTH);
}
示例2: getInstalled
public function getInstalled($uId)
{
$db_prefix = getDbPrefix();
$result = doQuery("SELECT `appid` FROM {$db_prefix}userapp WHERE `uid` = {$uId}");
$result = getSubByKey($result, 'appid');
return new APIResponse($result);
}
示例3: location_events
/**
* Output list of upcoming events for the location.
* @since 2.0.0
* @version 2.0.0
* @param integer $limit [optional] Event List Size (Default:5)
* @return void
*/
function location_events($limit = 5)
{
global $lID, $hc_cfg, $hc_lang_core, $hc_lang_locations;
$result = doQuery("SELECT PkID, Title, StartDate, StartTime, EndTime, TBD\r\n\t\t\t\t\t\tFROM " . HC_TblPrefix . "events \r\n\t\t\t\t\t\t\tWHERE IsActive = 1 AND IsApproved = 1 AND LocID = '" . cIn($lID) . "' AND StartDate >= '" . cIn(SYSDATE) . "'\r\n\t\t\t\t\t\tORDER BY StartDate, TBD, StartTime, Title\r\n\t\t\t\t\t\tLIMIT " . cIn($limit));
if (!hasRows($result)) {
echo '<p>' . $hc_lang_locations['NoEvents'] . ' <a href="' . CalRoot . '/index.php?com=submit" rel="nofollow">' . $hc_lang_locations['NoEventsLink'] . '</a></p>';
return 0;
}
$cnt = $date = 0;
while ($row = mysql_fetch_row($result)) {
if ($date != $row[2]) {
$date = $row[2];
echo $cnt > 0 ? '
</ul>' : '';
echo '
<header>' . stampToDate($row[2], $hc_cfg[14]) . '</header>
<ul>';
$cnt = 1;
}
$hl = $cnt % 2 == 0 ? ' class="hl"' : '';
if ($row[5] == 0) {
$time = $row[3] != '' ? stampToDate($row[3], $hc_cfg[23]) : '';
$time .= $row[4] != '' ? ' - ' . stampToDate($row[4], $hc_cfg[23]) : '';
$stamp = date("Y-m-d\\Th:i:00", strtotime($row[2] . trim(' ' . $row[3]))) . HCTZ;
} else {
$time = $row[5] == 1 ? $hc_lang_locations['AllDay'] : $hc_lang_locations['TBA'];
$stamp = date("Y-m-d", strtotime($row[2]));
}
echo '
<li' . $hl . ' itemscope itemtype="http://schema.org/Event"><time itemprop="startDate" datetime="' . $stamp . '">' . $time . '</time><a itemprop="url" href="' . CalRoot . '/index.php?eID=' . $row[0] . '"><span itemprop="name">' . cOut($row[1]) . '</span></a></li>';
++$cnt;
}
echo '</ul>';
}
示例4: cleanupRequests
function cleanupRequests($location, $table)
{
global $gSkipRuns, $gbActuallyDoit;
$query = "select * from crawls where location = '{$location}' and finishedDateTime is not null order by crawlid desc limit " . ($gSkipRuns + 1) . ";";
$results = doQuery($query);
mysql_data_seek($results, $gSkipRuns);
$row = mysql_fetch_assoc($results);
if ($gbActuallyDoit) {
$nUnfinished = doSimpleQuery("select count(*) from crawls where location = '{$location}' and finishedDateTime is null;");
if (0 < $nUnfinished) {
echo "SORRY! There is an unfinished crawl for location '{$location}'. Skipping the cleanup while the crawl is running.\n";
return;
}
// Actually delete rows and optimize the table.
echo "Delete requests from \"{$table}\" table starting with crawl \"{$row['label']}\" crawlid={$row['crawlid']} minPageid={$row['minPageid']} maxPageid={$row['maxPageid']}...\n";
$cmd = "delete from {$table} where crawlid <= {$row['crawlid']};";
echo "{$cmd}\n";
doSimpleCommand($cmd);
echo "DONE\nOptimize table \"{$table}\"...\n";
doSimpleCommand("optimize table {$table};");
echo "DONE\n";
} else {
echo "WOULD delete requests from \"{$table}\" table starting with crawl \"{$row['label']}\" crawlid={$row['crawlid']} minPageid={$row['minPageid']} maxPageid={$row['maxPageid']}...\n";
}
}
示例5: testCreateReservationFromWeekdaytoWeekend
public function testCreateReservationFromWeekdaytoWeekend(){
$this->setSessionUserAdmin();
$startDate = '2011-11-18'; # A Friday
$length = 1;
$endDate = '2011-11-21'; # The Next Monday
$actualLength = 3;
$equipId = 1;
$userComment = "test user comment";
$adminComment = "test admin comment";
$modStatus = RES_STATUS_PENDING;
createReservation(getSessionVariable('user_id'), $equipId, $startDate, $length, $userComment, $adminComment, $modStatus);
$actualReservation = mysql_fetch_assoc(doQuery("select * from ".getConfigVar('db_prefix')."_reservations ORDER BY res_id DESC LIMIT 1"));
$this->assertEquals(getSessionVariable('user_id'), $actualReservation['user_id'], "User IDs not equal");
$this->assertEquals($equipId, $actualReservation['equip_id'], "Equip IDs not equal");
$this->assertEquals($startDate, $actualReservation['start_date'], "Start dates not equal");
$this->assertEquals($actualLength, $actualReservation['length'], "Lengths not equal");
$this->assertEquals($endDate, $actualReservation['end_date'], "End dates not equal");
$this->assertEquals($userComment, $actualReservation['user_comment'], "User comments not equal");
$this->assertEquals($adminComment, $actualReservation['admin_comment'], "Admin comments not equal");
$this->assertEquals($modStatus, $actualReservation['mod_status'], "Statuses not equal");
}
示例6: areFriends
public function areFriends($uId1, $uId2)
{
$db_prefix = getDbPrefix();
$sql = "SELECT * FROM {$db_prefix}friend WHERE `uid` = '{$uId1}' AND `friend_uid` = '{$uId2}' AND `status` = '1' LIMIT 1";
$result = doQuery($sql) ? true : false;
return new APIResponse($result);
}
示例7: gridStatus
function gridStatus()
{
$gridStatus;
$result = doQuery("SELECT UNIX_TIMESTAMP(state.time) AS timestamp, value, id FROM state WHERE state.key = 'gridStatus'");
if ($result->numRows() == 1) {
$state = $result->fetchRow(DB_FETCHMODE_ASSOC);
if (time() - $state['timestamp'] > 300) {
$gridStatus = getGridStatus();
# print "Update " . $gridStatus;
if ($gridStatus != $state['value'] && $gridStatus != null) {
doQuery("UPDATE state SET time=null, value = '" . $gridStatus . "' WHERE id = " . $state['id']);
}
} else {
# print "Cached " . $state['value'];
$gridStatus = $state['value'];
}
} else {
$gridStatus = getGridStatus();
if ($gridStatus != null) {
# print "New " . $gridStatus;
doQuery("DELETE FROM state WHERE state.key = 'gridStatus'");
doQuery("INSERT INTO state VALUES(null, null, null, 'gridStatus', '{$gridStatus}')");
}
}
return $gridStatus;
}
示例8: addToLog
function addToLog($userid, $action, $description)
{
$userid = makeStringSafe($userid);
$action = makeStringSafe($action);
$description = makeStringSafe($description);
$mysqldate = getCurrentMySQLDateTime();
$ip = getClientIP();
$hostname = getClientHostname();
doQuery("INSERT INTO " . getDBPrefix() . "_log SET user_id = '" . $userid . "', action_type = '" . $action . "', action_description = '" . $description . "', date = '" . $mysqldate . "', ip = '" . $ip . "', hostname='" . $hostname . "'");
}
示例9: remove
function remove($appIds)
{
$db_prefix = getDbPrefix();
$appIds = "'" . implode("','", $appIds) . "'";
$result = doQuery("DELETE FROM {$db_prefix}myop_userapp WHERE `appid` IN ( {$appIds} )");
$result = doQuery("DELETE FROM {$db_prefix}myop_userappfield WHERE `appid` IN ( {$appIds} )") || $result;
$result = doQuery("DELETE FROM {$db_prefix}myop_myapp WHERE `appid` IN ( {$appIds} )") || $result;
//TODO: update cache
return new APIResponse($result);
}
示例10: getFriendInfo
function getFriendInfo($uId, $num = MY_FRIEND_NUM_LIMIT, $isExtra = false)
{
$users = $this->getUsers(array($uId), false, true, $isExtra, true, $num, false, true);
$db_prefix = getDbPrefix();
$totalNum = doQuery("SELECT COUNT(*) AS count FROM {$db_prefix}weibo_follow WHERE `uid` = {$uId}");
$totalNum = $totalNum[0]['count'];
$friends = $users[0]['friends'];
unset($users[0]['friends']);
$result = array('totalNum' => $totalNum, 'friends' => $friends, 'me' => $users[0]);
return new APIResponse($result);
}
示例11: ou_event_carousel
/**
* Output weekly dashboard to a page outside of Helios Calendar.
* @since 2.0.1
* @version 2.0.1
* @param binary $submit include submit event link, 0 = hide , 1 = show (Default:1)
* @param binary $ical include iCalendar subscription link, 0 = hide, 1 = show (Default:1)
* @param binary $rss include All Events rss feed link, 0 = hide, 1 = show (Default:1)
* @param binary $end_time include end time in event lists, 0 = hide, 1 = show (Default:1)
* @param string $menu_format menu format string, accepts any supported strftime() format parameters (Default:%a %m/%d)
* @return void
*/
function ou_event_carousel($submit = 1, $ical = 1, $rss = 1, $end_time = 1, $menu_format = '%a %m/%d')
{
global $hc_cfg, $hc_lang_core;
include HCLANG . '/public/integration.php';
echo "SYSDATE: " . SYSDATE . "\n";
if (file_exists(HCPATH . '/cache/int14_' . SYSDATE . '.php')) {
if (count(glob(HCPATH . '/cache/int14_*.php')) > 0) {
foreach (glob(HCPATH . '/cache/int14_*.php') as $file) {
unlink($file);
}
}
ob_start();
$fp = fopen(HCPATH . '/cache/int14_' . SYSDATE . '.php', 'w');
fwrite($fp, "<?php\n//\tHelios Dashboard Integration Events Cache - Delete this file when upgrading.\n");
//link, category, title, start date, end date, start time, end time, location, description
//array("05/15/2015 - 05/15/2015","1","test event")
$result = doQuery("SELECT PkID, Title, Description, StartDate, EndDate, StartTime, EndTime, TBD, LocID, LocationName FROM " . HC_TblPrefix . "events\nWHERE IsActive = 1 AND IsApproved = 1 AND StartDate Between '" . SYSDATE . "' AND ADDDATE('" . SYSDATE . "', INTERVAL 14 DAY)\nORDER BY StartDate, TBD, StartTime, Title, LocationName");
if (hasRows($result)) {
$cur_day = -1;
$cur_date = '';
fwrite($fp, "\$hc_next14 = array(\n");
while ($row = mysql_fetch_row($result)) {
print_r($row);
$ouTitle = $row[1];
$ouDesc = $row[2];
$ouLoc = $row[7];
//echo "\nouLoc: " . $ouLoc;
if ($cur_date = $row[3]) {
++$cur_day;
$cur_date = $row[3];
if ($cur_day > 0) {
fwrite($fp, "\t),\n");
}
fwrite($fp, $cur_day . " => array(\n");
}
if ($row[6] == 0) {
$time = $row[4] != '' ? stampToDate($row[4], $hc_cfg[24]) : '';
$time .= $row[5] != '' && $end_time == 1 ? ' - ' . stampToDate($row[5], $hc_cfg[24]) : '';
} else {
$time = $row[6] == 1 ? $hc_lang_int['AllDay'] : $hc_lang_int['TimeTBA'];
}
fwrite($fp, "\t" . $row[0] . " => array(\"" . $time . "\",\"" . stampToDate($row[3], $hc_cfg[15]) . "\",\"" . str_replace("\"", "'", cOut($row[1])) . "\"),\n");
}
fwrite($fp, "\t),");
}
fwrite($fp, "\n)\n?>");
fwrite($fp, ob_get_contents());
fclose($fp);
ob_end_clean();
}
include HCPATH . '/cache/int14_' . SYSDATE . '.php';
}
示例12: createRecentlyUsed
function createRecentlyUsed()
{
$maxEntries = 25;
$query = "SELECT pwd, status, date_format(last_used,\"%Y-%m-%d\"), dl_count FROM dl_pwds ORDER BY last_used DESC";
$result = doQuery($query);
$res = "<table>\n";
$res = $res . "<tr><td colspan=3><b>Recently used passwords:</b></td></tr>\n";
$entryCount = 0;
while (($row = mysql_fetch_row($result)) && $entryCount < $maxEntries) {
if (0 == $entryCount) {
$txt = "<tr>\n";
$txt = "<tr>";
$txt = $txt . "<td>Password</td>";
$txt = $txt . "<td width=\"20\"> </td>";
$txt = $txt . "<td>D/L count</td>";
$txt = $txt . "<td width=\"20\"> </td>";
$txt = $txt . "<td>Staus</td>\n";
$txt = $txt . "<td width=\"20\"> </td>";
$txt = $txt . "<td>Last used</td></tr>\n";
$res = $res . $txt;
}
$pwd = $row[0];
$status = $row[1];
if ($status == 'n') {
$status = "normal";
}
if ($status == 'r') {
$status = "rogue";
}
if ($status == 'd') {
$status = "disabled";
}
$dateLastUsed = $row[2];
$dlCount = $row[3];
if ($status == "rogue") {
$txt = '<tr style="color:red";>';
} else {
$txt = "<tr>";
}
$txt .= "\n <td>{$pwd}</td>";
$txt .= "\n <td width=\"20\"> </td>";
$txt .= "\n <td align=\"center\">{$dlCount}</td>";
$txt .= "\n <td width=\"20\"> </td>";
$txt .= "\n <td>{$status}</td>";
$txt .= "\n <td width=\"20\"> </td>";
$txt .= "\n <td>{$dateLastUsed}</td>\n</tr>\n";
$res = $res . $txt;
$entryCount += 1;
}
$res = $res . "</table>\n";
return $res;
}
示例13: doQueryQueue
function doQueryQueue($i_queries)
{
global $g_db, $lngstr;
$g_db->debug = true;
if ($i_queries) {
foreach ($i_queries as $i_table => $i_tablequeries) {
foreach ($i_tablequeries as $i_queryid => $i_query) {
doQuery($i_queryid > 0 ? '' : sprintf($lngstr['install_db']['create_or_modify_tablex'], $i_table), $i_query);
}
}
}
$g_db->debug = false;
}
示例14: checkPassword
function checkPassword($pwd)
{
$query = "\r\n\tSELECT dl_count\r\n\t FROM dl_pwds\r\n\t WHERE pwd='{$pwd}'\r\n AND status='n'";
$result = doQuery($query);
if (!($row = mysql_fetch_row($result))) {
return PWD_CHECK_NOT_FOUND;
}
$count = $row[0];
//check if the file hasn't been used more than 3 times
if ($count > ALLOWED_DLS_COUNT - 1) {
return PWD_CHECK_USED_TOO_MANY_TIMES;
}
return PWD_CHECK_VALID;
}
示例15: isEquipmentReserved
function isEquipmentReserved($equipid, $date)
{
$equipid = makeStringSafe($equipid);
$date = makeStringSafe($date);
$start_Date = new DateTime($date);
$start_Date->modify("+3 day");
//$interval = new DateInterval("P3D");
//$start_Date->add($interval);
$result = doQuery("SELECT * FROM " . getDBPrefix() . "_reservations WHERE equip_id = '" . $equipid . "' AND (mod_status = '" . RES_STATUS_CONFIRMED . "' or mod_status = '" . RES_STATUS_PENDING . "') AND (start_date BETWEEN '" . $date . "' and '" . $start_Date->format("Y-m-d") . "')");
if (mysql_num_rows($result) > 0) {
return true;
} else {
return false;
}
}