本文整理汇总了PHP中sql_result函数的典型用法代码示例。如果您正苦于以下问题:PHP sql_result函数的具体用法?PHP sql_result怎么用?PHP sql_result使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sql_result函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: create_n_populate_tables
private function create_n_populate_tables()
{
$sql = null;
$result = null;
// Create states table
$sql = "CREATE TABLE states (STATE varchar(36), CODE varchar(2))";
$result = sql_result($sql);
echo "\"states\" table is created...<br />";
// Populate states table
$sql = "LOAD DATA\n LOCAL INFILE 'database/states.csv'\n INTO TABLE states\n FIELDS TERMINATED BY \",\" OPTIONALLY ENCLOSED BY '\"'\n LINES TERMINATED BY '\r\n'\n IGNORE 1 LINES";
$result = sql_result($sql);
echo "\"states\" table is populated...<br />";
// Create country table
$sql = "CREATE TABLE country (CODE varchar(3), NAME varchar(25))";
$result = sql_result($sql);
echo "\"country\" table is created...<br />";
// Populate country table
$sql = "LOAD DATA\n LOCAL INFILE 'database/country.csv'\n INTO TABLE country\n FIELDS TERMINATED BY \",\" OPTIONALLY ENCLOSED BY '\"'\n LINES TERMINATED BY '\r\n'\n IGNORE 1 LINES";
$result = sql_result($sql);
echo "\"country\" table is populated...<br />";
// Create airports table
$sql = "CREATE TABLE airports (CODE varchar(3), NAME varchar(32), CITY varchar(32), STATE varchar(2), COUNTRY varchar(2), X float, Y float)";
$result = sql_result($sql);
echo "\"airports\" table is created...<br />";
// Populate airports table
$sql = "LOAD DATA\n LOCAL INFILE 'database/airports.csv'\n INTO TABLE airports\n FIELDS TERMINATED BY \",\" OPTIONALLY ENCLOSED BY '\"'\n LINES TERMINATED BY '\r\n'\n IGNORE 1 LINES";
$result = sql_result($sql);
echo "\"airports\" table is populated...<br /><br />";
}
示例2: rr_delete
function rr_delete()
{
global $rr_table_name, $auto_update_ptr, $rr_active_types, $allow_ixfr;
/* Load the SOA for this zone */
$soa = sql_result(soa_select() . "WHERE id=" . (int) $_POST['zone'], "SOA record for zone {$_POST['zone']}");
/* Get form vars */
$rr = rr_post_vars($soa);
if ($allow_ixfr) {
sql_query("UPDATE {$rr_table_name} SET active='" . $rr_active_types[2] . "',serial=" . (int) next_serial($soa['serial']) . " WHERE id=" . (int) $rr['id']) or ErrSQL("Error marking record deleted " . (int) $rr['id'] . " from zone " . (int) $soa['id'] . ".");
} else {
/* Delete the resource record */
sql_query("DELETE FROM {$rr_table_name} WHERE id=" . (int) $rr['id']) or ErrSQL("Error deleting record " . (int) $rr['id'] . " from zone " . (int) $soa['id'] . ".");
}
/* Update serial number for zone if configured to do so */
soa_update_serial($soa);
/* Do PTR record update if configured to do so */
if ($auto_update_ptr) {
if ($rr['type'] == "A") {
$arpazone = ptr_create_soa($rr['data'], $name);
ptr_delete_rr($arpazone, $name, $rr['name'], $soa['origin']);
}
}
zone_redirect($soa['id']);
}
示例3: sql_pre_query
$name_check = 0;
$prequery = sql_pre_query("SELECT * FROM \"" . $Settings['sqltable'] . "groups\" WHERE \"id\"=%i LIMIT 1", array($_POST['id']));
$preresult = sql_query($prequery, $SQLStat);
$prenum = sql_num_rows($preresult);
if ($prenum == 0) {
redirect("location", $rbasedir . url_maker($exfile['admin'], $Settings['file_ext'], "act=view", $Settings['qstr'], $Settings['qsep'], $prexqstr['admin'], $exqstr['admin'], false));
sql_free_result($preresult);
ob_clean();
header("Content-Type: text/plain; charset=" . $Settings['charset']);
$urlstatus = 302;
gzip_page($Settings['use_gzip'], $GZipEncode['Type']);
session_write_close();
die;
}
if ($prenum >= 1) {
$OldGroupName = sql_result($preresult, 0, "Name");
sql_free_result($preresult);
if ($_POST['GroupName'] != $OldGroupName) {
$sql_name_check = sql_query(sql_pre_query("SELECT \"Name\" FROM \"" . $Settings['sqltable'] . "groups\" WHERE \"Name\"='%s'", array($_POST['GroupName'])), $SQLStat);
$name_check = sql_num_rows($sql_name_check);
sql_free_result($sql_name_check);
}
$errorstr = "";
if (!isset($_POST['PromotePosts'])) {
$_POST['PromotePosts'] = 0;
}
if ($_POST['PromotePosts'] == null || !is_numeric($_POST['PromotePosts'])) {
$_POST['PromotePosts'] = 0;
}
if (!isset($_POST['PromoteKarma'])) {
$_POST['PromoteKarma'] = 0;
示例4: sql_query
}
$bdresult = sql_query($bdquery, $SQLStat);
$bdmembers = sql_num_rows($bdresult);
$bdi = 0;
if ($bdmembers > 0) {
$bdstring = $bdmembers . " member(s) have a birthday today";
}
if ($bdmembers <= 0) {
$bdstring = "<div> </div> No members have a birthday today<div> </div>";
}
while ($bdi < $bdmembers) {
$bdmemberz = $bdmembers - 1;
$birthday['ID'] = sql_result($bdresult, $bdi, "id");
$birthday['Name'] = sql_result($bdresult, $bdi, "Name");
$birthday['IP'] = sql_result($bdresult, $bdi, "IP");
$birthday['BirthYear'] = sql_result($bdresult, $bdi, "BirthYear");
$bdThisYear = GMTimeGet("Y", $_SESSION['UserTimeZone'], 0, $_SESSION['UserDST']);
$birthday['Age'] = $bdThisYear - $birthday['BirthYear'];
$bdMemTitle = null;
if ($GroupInfo['HasAdminCP'] == "yes") {
$bdMemTitle = " title=\"" . $birthday['IP'] . "\"";
}
if ($bdi === 0) {
$bdstring = $bdstring . "\n<br /> ";
}
$bdMemURL = "<a" . $bdMemTitle . " href=\"" . url_maker($exfile['member'], $Settings['file_ext'], "act=view&id=" . $birthday['ID'], $Settings['qstr'], $Settings['qsep'], $prexqstr['member'], $exqstr['member']) . "\">" . $birthday['Name'] . "</a>";
if ($bdi < $bdmemberz) {
$bdstring = $bdstring . $bdMemURL . " (<span style=\"font-weight: bold;\">" . $birthday['Age'] . "</span>), ";
}
if ($bdi == $bdmemberz) {
$bdstring = $bdstring . $bdMemURL . " (<span style=\"font-weight: bold;\">" . $birthday['Age'] . "</span>)";
示例5: sql_free_result
$NextDay++;
}
}
$EventsID[$EventDay] = $EventID;
++$is;
}
sql_free_result($result);
$bdquery = sql_pre_query("SELECT * FROM \"" . $Settings['sqltable'] . "members\" WHERE \"BirthMonth\"=%i", array($MyMonth));
$bdresult = sql_query($bdquery, $SQLStat);
$bdnum = sql_num_rows($bdresult);
$bdi = 0;
while ($bdi < $bdnum) {
$UserNamebd = sql_result($bdresult, $bdi, "Name");
$BirthDay = sql_result($bdresult, $bdi, "BirthDay");
$BirthMonth = sql_result($bdresult, $bdi, "BirthMonth");
$BirthYear = sql_result($bdresult, $bdi, "BirthYear");
$oldusername = $UserNamebd;
$UserNamebd1 = pre_substr($UserNamebd, 0, 20);
if (pre_strlen($UserNamebd) > 20) {
$UserNamebd1 = $UserNamebd1 . "...";
}
$UserNamebd = $UserNamebd1;
if (!isset($EventsName[$BirthDay])) {
$EventsName[$BirthDay] = null;
}
if ($EventsName[$BirthDay] != null) {
$EventsName[$BirthDay] .= ", <span title=\"" . $oldusername . "'s birthday.\">" . $UserNamebd1 . "</span>";
}
if ($EventsName[$BirthDay] == null) {
$EventsName[$BirthDay] = "<span title=\"" . $oldusername . "'s birthday.\">" . $UserNamebd1 . "</span>";
}
示例6: sql_pre_query
if ($ForumType == "subforum") {
$apcquery = sql_pre_query("SELECT * FROM \"" . $Settings['sqltable'] . "forums\" WHERE \"ShowForum\"='yes' AND \"InSubForum\"=%i" . $ForumIgnoreList2 . " ORDER BY \"OrderID\" ASC, \"id\" ASC", array($ForumID));
$apcresult = sql_query($apcquery, $SQLStat);
$apcnum = sql_num_rows($apcresult);
$apci = 0;
$apcl = 1;
if ($apcnum >= 1) {
while ($apci < $apcnum) {
$NumsTopics = sql_result($apcresult, $apci, "NumTopics");
$NumTopics = $NumsTopics + $NumTopics;
$NumsPosts = sql_result($apcresult, $apci, "NumPosts");
$NumPosts = $NumsPosts + $NumPosts;
$SubsForumID = sql_result($apcresult, $apci, "id");
$SubsForumName = sql_result($apcresult, $apci, "Name");
$SubsForumType = sql_result($apcresult, $apci, "ForumType");
$SubsForumShowTopics = sql_result($result, $i, "CanHaveTopics");
if (isset($PermissionInfo['CanViewForum'][$SubsForumID]) && $PermissionInfo['CanViewForum'][$SubsForumID] == "yes") {
$ExStr = "";
if ($SubsForumType != "redirect" && $SubsForumShowTopics != "no") {
$ExStr = "&page=1";
}
$shownum = null;
if ($SubsForumType == "redirect") {
$shownum = "(" . $NumRedirects . " redirects)";
}
if ($SubsForumType != "redirect") {
$shownum = "(" . $NumsPosts . " posts)";
}
$sfurl = "<a href=\"";
$sfurl = url_maker($exfile[$SubsForumType], $Settings['file_ext'], "act=lowview&id=" . $SubsForumID . $ExStr, $Settings['qstr'], $Settings['qsep'], $prexqstr[$SubsForumType], $exqstr[$SubsForumType]);
$sfurl = "<li><ul style=\"list-style-type: none;\"><li><a href=\"" . $sfurl . "\">" . $SubsForumName . "</a><span style=\"color: gray; font-size: 10px;\">" . $shownum . "</span></li></ul></li>";
示例7: sql_result
$Per2Error = true;
}
$CatPermissionInfo['ID'][$PerCatID] = sql_result($per2esult, $per2i, "id");
if (!is_numeric($CatPermissionInfo['ID'][$PerCatID])) {
$Per2Error = true;
}
$CatPermissionInfo['PermissionID'][$PerCatID] = sql_result($per2esult, $per2i, "PermissionID");
if (!is_numeric($CatPermissionInfo['PermissionID'][$PerCatID])) {
$Per2Error = true;
}
$CatPermissionInfo['Name'][$PerCatID] = sql_result($per2esult, $per2i, "Name");
$CatPermissionInfo['CategoryID'][$PerCatID] = sql_result($per2esult, $per2i, "CategoryID");
if (!is_numeric($CatPermissionInfo['CategoryID'][$PerCatID])) {
$Per2Error = true;
}
$CatPermissionInfo['CanViewCategory'][$PerCatID] = sql_result($per2esult, $per2i, "CanViewCategory");
if ($CatPermissionInfo['CanViewCategory'][$PerCatID] != "yes" && $CatPermissionInfo['CanViewCategory'][$PerCatID] != "no") {
$Per2Error = true;
}
if ($CatPermissionInfo['CanViewCategory'][$PerCatID] == "no") {
if (strlen($CatIgnoreList1) > 1) {
$CatIgnoreList1 .= " AND \"id\"<>" . $PerCatID;
}
if (strlen($CatIgnoreList1) < 1) {
$CatIgnoreList1 = " \"id\"<>" . $PerCatID;
}
if (strlen($CatIgnoreList2) > 1) {
$CatIgnoreList2 .= " AND \"id\"<>" . $PerCatID;
}
if (strlen($CatIgnoreList2) < 1) {
$CatIgnoreList2 = " AND \"id\"<>" . $PerCatID;
示例8: count
$themenum = count($themelist);
$themei = 0;
while ($themei < $themenum) {
echo $themelist[$themei] . "\n";
++$themei;
}
}
}
if ($Settings['SQLThemes'] == "on") {
$sknquery = sql_pre_query("SELECT * FROM \"" . $Settings['sqltable'] . "themes\" ORDER BY \"id\" ASC, \"Name\" ASC", array(null));
$sknresult = sql_query($sknquery, $SQLStat);
$sknum = sql_num_rows($sknresult);
$skni = 0;
while ($skni < $sknum) {
$ThemeInfo['Name'] = sql_result($sknresult, $skni, "Name");
$ThemeInfo['ThemeName'] = sql_result($sknresult, $skni, "ThemeName");
if ($Settings['DefaultTheme'] == $ThemeInfo['Name']) {
echo "<option selected=\"selected\" value=\"" . $ThemeInfo['Name'] . "\">" . $ThemeInfo['ThemeName'] . "</option>\n";
}
if ($Settings['DefaultTheme'] != $ThemeInfo['Name']) {
echo "<option value=\"" . $ThemeInfo['Name'] . "\">" . $ThemeInfo['ThemeName'] . "</option>\n";
}
++$skni;
}
}
?>
</select></td>
<?php
if ($_GET['board'] == $Settings['root_board']) {
?>
</tr><tr style="text-align: left;">
示例9: sql_pre_query
</tr>
<tr class="TableMenuRow4">
<td class="TableMenuColumn4"> </td>
</tr>
</table>
</div>
<?php
}
if ($_POST['act'] == "editmember" && $_POST['update'] == "now" && $_GET['act'] == "editmember" && ($_POST['id'] != "0" || $_POST['id'] != "-1")) {
$ggidquery = sql_pre_query("SELECT * FROM \"" . $Settings['sqltable'] . "groups\" WHERE \"Name\"='%s' LIMIT 1", array($Settings['GuestGroup']));
$ggidresult = sql_query($ggidquery, $SQLStat);
$GuestGroupID = sql_result($ggidresult, 0, "id");
sql_free_result($ggidresult);
$vgidquery = sql_pre_query("SELECT * FROM \"" . $Settings['sqltable'] . "groups\" WHERE \"Name\"='%s' LIMIT 1", array($Settings['ValidateGroup']));
$vgidresult = sql_query($vgidquery, $SQLStat);
$ValidateGroupID = sql_result($vgidresult, 0, "id");
sql_free_result($vgidresult);
$DMemName = GetUserName($_POST['id'], $Settings['sqltable']);
$DMemName = $DMemName['Name'];
$_POST['MemName'] = stripcslashes(htmlspecialchars($_POST['MemName'], ENT_QUOTES, $Settings['charset']));
//$_POST['MemName'] = preg_replace("/&#(x[a-f0-9]+|[0-9]+);/i", "&#$1;", $_POST['MemName']);
$_POST['MemName'] = remove_spaces($_POST['MemName']);
$_POST['MemEmail'] = remove_spaces($_POST['MemEmail']);
$username_check = null;
if ($_POST['MemName'] != $DMemName) {
$tquery = sql_pre_query("UPDATE \"" . $Settings['sqltable'] . "topics\" SET \"GuestName\"='%s' WHERE \"UserID\"=%i", array($_POST['MemName'], $_POST['id']));
sql_query($tquery, $SQLStat);
$r1query = sql_pre_query("UPDATE \"" . $Settings['sqltable'] . "posts\" SET \"GuestName\"='%s' WHERE \"UserID\"=%i", array($_POST['MemName'], $_POST['id']));
sql_query($r1query, $SQLStat);
$r2query = sql_pre_query("UPDATE \"" . $Settings['sqltable'] . "posts\" SET \"EditUserName\"='%s' WHERE \"EditUser\"=%i", array($_POST['MemName'], $_POST['id']));
sql_query($r2query, $SQLStat);
示例10: sql_result
if ($numlog2 == 1) {
$YourIDAM = sql_result($resultlog2, 0, "id");
$YourNameAM = sql_result($resultlog2, 0, "Name");
$YourGroupAM = sql_result($resultlog2, 0, "GroupID");
$YourGroupIDAM = $YourGroupAM;
$YourPassAM = sql_result($resultlog2, 0, "UserPassword");
$gquery = sql_pre_query("SELECT * FROM \"" . $Settings['sqltable'] . "groups\" WHERE \"id\"=%i LIMIT 1", array($YourGroupAM));
$gresult = sql_query($gquery, $SQLStat);
$YourGroupAM = sql_result($gresult, 0, "Name");
sql_free_result($gresult);
$BanError = null;
$YourTimeZoneAM = sql_result($resultlog2, 0, "TimeZone");
$UseThemeAM = sql_result($resultlog2, 0, "UseTheme");
$YourDSTAM = sql_result($resultlog2, 0, "DST");
$YourLastPostTime = sql_result($resultlog2, 0, "LastPostTime");
$YourBanTime = sql_result($resultlog2, 0, "BanTime");
sql_free_result($resultlog2);
$CGMTime = GMTimeStamp();
if ($YourBanTime != 0 && $YourBanTime != null) {
if ($YourBanTime >= $CGMTime) {
$BanError = "yes";
}
if ($YourBanTime < 0) {
$BanError = "yes";
}
}
$NewDay = GMTimeStamp();
$NewIP = $_SERVER['REMOTE_ADDR'];
if ($BanError != "yes") {
$queryup = sql_pre_query("UPDATE \"" . $Settings['sqltable'] . "members\" SET \"LastActive\"=%i,\"IP\"='%s' WHERE \"id\"=%i", array($NewDay, $NewIP, $YourIDAM));
$_SESSION['Theme'] = $UseThemeAM;
示例11: sql_query
<td><b>Avg time</b></td>
<td><b>Total time</b></td>
<td><b>%</b></td>
<td><b>W/M Requests</b></td>
<td><b>W/M Avg time</b></td>
<td><b>W/M Total time</b></td>
<td><b>W/M %</b></td>
</tr>
<?php
$prfResult = sql_query("SELECT SUM(`prfTime`) FROM `profiler`");
$totalTime = sql_result($prfResult);
if ($totalTime == 0) {
$totalTime = 1;
}
$prfResult = sql_query("SELECT SUM(`prfWMTime`) FROM `profiler`");
$totalTimeWM = sql_result($prfResult);
if ($totalTimeWM == 0) {
$totalTimeWM = 1;
}
$prfResult = sql_query("SELECT * FROM `profiler` ORDER BY `prfTime` DESC");
while ($prfData = sql_next($prfResult)) {
if ($prfData["prfCount"] == 0) {
$prfData["prfCount"] = 1;
}
if ($prfData["prfWMCount"] == 0) {
$prfData["prfWMCount"] = 1;
}
if (strpos($prfData["prfPage"], "(bot)") !== false) {
$prfData["prfPage"] = '<span class="error">' . $prfData["prfPage"] . '</span>';
}
?>
示例12: sql_pre_query
<div style="width: 100%; height: 160px; overflow: auto;">
<table style="width: 100%; text-align: center;"><?php
$renee_query = sql_pre_query("SELECT * FROM \"" . $Settings['sqltable'] . "smileys\" WHERE \"Display\"='yes'", array(null));
$renee_result = sql_query($renee_query, $SQLStat);
$renee_num = sql_num_rows($renee_result);
$renee_s = 0;
$SmileRow = 0;
$SmileCRow = 0;
while ($renee_s < $renee_num) {
++$SmileRow;
$FileName = sql_result($renee_result, $renee_s, "FileName");
$SmileName = sql_result($renee_result, $renee_s, "SmileName");
$SmileText = sql_result($renee_result, $renee_s, "SmileText");
$SmileDirectory = sql_result($renee_result, $renee_s, "Directory");
$ShowSmile = sql_result($renee_result, $renee_s, "Display");
$ReplaceType = sql_result($renee_result, $renee_s, "ReplaceCI");
if ($SmileRow == 1) {
?>
<tr>
<?php
}
if ($SmileRow < 5) {
++$SmileCRow;
?>
<td><img src="<?php
echo $SmileDirectory . "" . $FileName;
?>
" style="vertical-align: middle; border: 0px; cursor: pointer;" title="<?php
echo $SmileName;
?>
" alt="<?php
示例13: sql_pre_query
}
if (!isset($SetupDir['setup'])) {
$SetupDir['setup'] = "setup/";
}
if (!isset($SetupDir['convert'])) {
$SetupDir['convert'] = "setup/convert/";
}
$query = sql_pre_query("ALTER DATABASE \"" . $_POST['DatabaseName'] . "\" DEFAULT CHARACTER SET " . $Settings['sql_charset'] . " COLLATE " . $Settings['sql_collate'] . ";", array(null));
sql_query($query, $SQLStat);
if (isset($Settings['sql_storage_engine'])) {
$result = sql_query(sql_pre_query("SHOW ENGINES;", array(null)), $SQLStat);
$num = sql_num_rows($result);
$i = 0;
$SQLEngines = null;
while ($i < $num) {
$SQLEngines[$i] = sql_result($result, $i, "Engine");
++$i;
}
if (!in_array($Settings['sql_storage_engine'], $SQLEngines)) {
$Settings['sql_storage_engine'] = "MyISAM";
}
}
if (!isset($Settings['sql_storage_engine'])) {
$Settings['sql_storage_engine'] = "MyISAM";
}
// You can set this to MyISAM or Maria/Aria
if ($Settings['sql_storage_engine'] == "CSV") {
$SQLStorageEngine = "CSV";
}
if ($Settings['sql_storage_engine'] == "Maria") {
$SQLStorageEngine = "Maria";
示例14: load_danhmuc_option
function load_danhmuc_option()
{
$sql_load_cat = "select * from danh_muc ORDER BY cat_id";
$kq_load_cat = sql_result($sql_load_cat);
//echo $sql_load_cat;
while ($row = mysql_fetch_array($kq_load_cat, MYSQL_ASSOC)) {
if ($row['cat_id_cha'] == 0) {
echo "<option value='" . $row['cat_id'] . "'>" . $row['cat_name'] . "</option>";
} else {
echo "<option style='background-color:yellow;' disabled value='" . $row['cat_id'] . "'>" . $row['cat_name'] . "</option>";
}
}
}
示例15: sql_result
//$kt_kichhoat=get_value_2dk('xacnhan','Code',$ma_kh,'ID',$id_kh,'Status');
//echo $kt_kichhoat;
if (isset($kt_validate) && $status == "NO") {
if ($time_ex < $time_current) {
$sql_update_status = "update xacnhan set Status='YES' where ID='{$id_kh}'";
$kq_update_status = sql_result($sql_update_status);
echo "<br/>Kích hoạt thành công. Sẽ quay lại trang chủ trong 5 giây.";
//Set Cookie
$username = get_value_dk('thanhvien', 'ID', $id_kh, 'Username');
setcookie("name", $username, time() + 86400);
echo "<meta http-equiv='refresh' content='5;url=index.php'>";
} else {
echo "\t\t<br/>KÍCH HOẠT THẤT BẠI vì:<br/>\n\t\t\t- Link kích hoạt đã hết hạn. !<br/>";
echo "<br/>Sẽ quay lại trang chủ trong 5 giây.";
$sql_delete_thanhvien = "delete from thanhvien where ID='{$id_kh}'";
$kq_delete_thanhvien = sql_result($sql_delete_thanhvien);
echo "<meta http-equiv='refresh' content='5;url=index.php'>";
}
} else {
echo "\t\t<br/>KHÔNG THỂ XÁC NHẬN EMAIL NÀY VÌ:<br/>\n\t\t- Email này đã được kích hoạt!<br/>\n\t\t- Email và mã kích hoạt không trùng khớp!<br/>";
}
} else {
}
?>
<?php
include "right.php";
include "footer.php";
?>