本文整理汇总了PHP中mysqli_result函数的典型用法代码示例。如果您正苦于以下问题:PHP mysqli_result函数的具体用法?PHP mysqli_result怎么用?PHP mysqli_result使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了mysqli_result函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getResult
function getResult($query)
{
return mysqli_result($this->conn, $query);
}
示例2: read_invitations
function read_invitations()
{
global $TABLE_PREFIX, $admintpl, $language, $CURUSER, $STYLEPATH, $btit_settings;
$scriptname = htmlspecialchars($_SERVER["PHP_SELF"] . "?page=admin&user=" . $CURUSER["uid"] . "&code=" . $CURUSER["random"] . "&do=invitations");
$addparam = "";
$res = get_result("SELECT COUNT(*) as invites FROM {$TABLE_PREFIX}invitations", true);
$count = $res[0]["invites"];
list($pagertop, $pagerbottom, $limit) = pager('15', $count, $scriptname . "&");
$admintpl->set("inv_pagertop", $pagertop);
$admintpl->set("inv_pagerbottom", $pagerbottom);
$results = get_result("SELECT * FROM {$TABLE_PREFIX}invitations ORDER BY id DESC {$limit}", true);
$invitees = array();
$i = 0;
foreach ($results as $id => $data) {
$res = do_sqlquery("SELECT username FROM {$TABLE_PREFIX}users WHERE id = " . $data["inviter"], true);
if (mysqli_num_rows($res) > 0) {
$inviter_name = mysqli_result($res, 0, 0);
} else {
$inviter_name = 'Unknown';
}
$invitees[$i]["inviter"] = "<a href=\"index.php?page=userdetails&user=" . $data["inviter"] . "\">" . $inviter_name . "</a>";
$invitees[$i]["invitee"] = unesc($data["invitee"]);
$invitees[$i]["hash"] = unesc($data["hash"]);
$invitees[$i]["time_invited"] = $data["time_invited"];
$invitees[$i]["delete"] = "<a href=\"index.php?page=admin&user=" . $CURUSER["uid"] . "&code=" . $CURUSER["random"] . "&do=invitations&action=delete&id=" . $data["id"] . "\" onclick=\"return confirm('" . AddSlashes($language["DELETE_CONFIRM"]) . "')\">" . image_or_link("{$STYLEPATH}/images/delete.png", "", $language["DELETE"]) . "</a>";
$i++;
}
$admintpl->set("invitees", $invitees);
$admintpl->set("language", $language);
}
示例3: user_id_from_username
function user_id_from_username($username)
{
global $db;
$username = sanitize($username);
$query2 = mysqli_query($db, "SELECT (`id`) FROM `users` WHERE `username` = '{$username}'");
return mysqli_result($query2, 0, 'id');
}
示例4: book_exists
function book_exists($bookname)
{
global $db;
$bookname = sanitize($bookname);
$query = mysqli_query($db, "SELECT COUNT(`title`) FROM `books` WHERE `title` = '{$bookname}'");
return mysqli_result($query, 0) == 1 ? true : false;
}
示例5: product_picture
function product_picture($product_id)
{
$connect = Database();
$picture_result = mysqli_result(mysqli_query($connect, "SELECT picture_type FROM product_pictures WHERE product_id='{$product_id}';"));
$picture_type = $picture_result['picture_type'];
$picture_url = "../@pages/images/products/" . $product_id . "_1." . $picture_type;
return $picture_url;
}
示例6: plogger_stats_count_total_comments
function plogger_stats_count_total_comments()
{
$query = "SELECT COUNT(*) AS `n` FROM `" . PLOGGER_TABLE_PREFIX . "comments` WHERE approved = 1";
$result = run_query($query);
$num_comments = mysqli_result($result, 0, 'n');
echo $num_comments . ' ';
echo $num_comments == 1 ? plog_tr('comment') : plog_tr('comments');
}
示例7: user_count
function user_count()
{
// pentru a arata cati utilizatori inregistrati avem pe site
include 'core/db/db_connection.php';
$sql = "SELECT COUNT(user_id) FROM `_users` WHERE active = 1";
$data = mysqli_query($dbCon, $sql);
return mysqli_result($data, 0);
}
示例8: getScoreByStrategy
function getScoreByStrategy($roundId, $strategyId)
{
$link = getDBConnection();
if (mysqli_select_db($link, getDBName())) {
$roundId = intval($roundId);
$strategyId = intval($strategyId);
return mysqli_result(mysqli_query($link, "SELECT score FROM scores WHERE round = {$roundId} AND strategy = {$strategyId}"), 0);
}
}
示例9: login
function login($username, $password)
{
require 'core/database/connect.php';
//file that connects to database
$user_id = user_id_from_username($username);
$username = sanitize($username);
// $password = md5($password); ideally we want to encrypt the password when the user registers
return mysqli_result(mysqli_query($connect, "SELECT COUNT(`ID`) FROM `users` WHERE `UserName` = '{$username}' AND `Password` = '{$password}'"), 0) == 1 ? $user_id : false;
}
示例10: tableExists
function tableExists($tablename, $database = false)
{
global $dbTmp;
if (!$database) {
$res = mysqli_query($dbTmp, "SELECT DATABASE()");
$database = mysqli_result($res, 0);
}
$res = mysqli_query($dbTmp, "SELECT COUNT(*) as count\n FROM information_schema.tables\n WHERE table_schema = '{$database}'\n AND table_name = '{$tablename}'");
return mysqli_result($res, 0) == 1;
}
示例11: grr_sql_query1
function grr_sql_query1($sql)
{
$r = mysqli_query($GLOBALS['db_c'], $sql);
if (!$r) {
return -1;
}
if (mysqli_num_rows($r) != 1 || mysqli_field_count($GLOBALS['db_c']) != 1 || ($result_ = mysqli_result($r, 0, 0)) == "") {
$result_ = -1;
}
mysqli_free_result($r);
return $result_;
}
示例12: login
function login()
{
$db_host = 'localhost';
$db_username = 'root';
$db_password = '';
$db_name = 'Attendance';
$con = mysql_connect($db_host, $db_username, $db_password) or die(mysql_error());
mysql_select_db($db_name);
$query = "SELECT * FROM users WHERE email = '" . $_POST['email'] . "' AND password = '" . $_POST['password'] . "'; ";
mysqli_query($conn, $query);
if (mysqli_result()) {
header("Location: Attendace.php");
/* Redirect browser */
exit;
} else {
$credentials = false;
}
}
示例13: read_styles
function read_styles()
{
global $TABLE_PREFIX, $language, $CURUSER, $admintpl, $STYLEPATH;
$sres = style_list();
for ($i = 0; $i < count($sres); $i++) {
$res = do_sqlquery("SELECT COUNT(*) FROM {$TABLE_PREFIX}users WHERE style = " . $sres[$i]["id"], true);
$sres[$i]["style_users"] = mysqli_result($res, 0, 0);
$sres[$i]["style"] = unesc($sres[$i]["style"]);
$sres[$i]["style_url"] = unesc($sres[$i]["style_url"]);
$sres[$i]["style_type"] = $sres[$i]["style_type"] == 1 ? $language["CLA_STYLE"] : ($sres[$i]["style_type"] == 2 ? $language["ATM_STYLE"] : ($sres[$i]["style_type"] == 3 ? $language["PET_STYLE"] : $language["UNKNOWN"]));
$sres[$i]["edit"] = "<a href=\"index.php?page=admin&user=" . $CURUSER["uid"] . "&code=" . $CURUSER["random"] . "&do=style&action=edit&id=" . $sres[$i]["id"] . "\">" . image_or_link("{$STYLEPATH}/images/edit.png", "", $language["EDIT"]) . "</a>";
$sres[$i]["delete"] = "<a href=\"index.php?page=admin&user=" . $CURUSER["uid"] . "&code=" . $CURUSER["random"] . "&do=style&action=delete&id=" . $sres[$i]["id"] . "\" onclick=\"return confirm('" . AddSlashes($language["DELETE_CONFIRM"]) . "')\">" . image_or_link("{$STYLEPATH}/images/delete.png", "", $language["DELETE"]) . "</a>";
}
$admintpl->set("style_add", false, true);
$admintpl->set("language", $language);
$admintpl->set("styles", $sres);
$admintpl->set("style_add_new", "<a href=\"index.php?page=admin&user=" . $CURUSER["uid"] . "&code=" . $CURUSER["random"] . "&do=style&action=add\">" . $language["STYLE_ADD"] . "</a>");
unset($sres);
mysqli_free_result($res) || is_object($res) && get_class($res) == "mysqli_result" ? true : false;
}
示例14: ishappyHour
function ishappyHour($n)
{
global $TABLE_PREFIX;
$happyHour = mysqli_result(mysqli_query($GLOBALS["___mysqli_ston"], "SELECT UNIX_TIMESTAMP(value_s) FROM {$TABLE_PREFIX}avps WHERE arg='happyhour'"), 0);
$happyDate = date("Y-m-d H:i", $happyHour);
$curDate = date("Y-m-d H:i");
$nextDate = date("Y-m-d H:i", $happyHour + 3600);
if ($n == "check") {
if ($happyDate < $curDate && $nextDate >= $curDate) {
return true;
}
}
if ($n == "time") {
$timeLeft = $happyHour + 3600 - time();
return NDF($timeLeft);
}
}
示例15: unesc
$modules[$i]["module_activated"] = $language["NO"] . " -> <a href=\"index.php?page=admin&user=" . $CURUSER["uid"] . "&code=" . $CURUSER["random"] . "&do=module_config&action=change_to_yes&id=" . unesc($row_modules["id"]) . "\">" . $language["ACTIVATE"] . "</a>";
}
// yes
$modules[$i]["module_date_changed"] = unesc($row_modules["changed"]);
// when last switched on or off
$modules[$i]["module_date_created"] = unesc($row_modules["created"]);
// the date created
$i++;
}
$admintpl->set("modules", $modules);
$active_modules = do_sqlquery("SELECT COUNT(*) FROM {$TABLE_PREFIX}modules WHERE activated='yes'", true);
$admintpl->set("nr_active_modules", mysqli_result($active_modules, 0, 0));
$not_active_modules = do_sqlquery("SELECT COUNT(*) FROM {$TABLE_PREFIX}modules WHERE activated='no'", true);
$admintpl->set("nr_not_active_modules", mysqli_result($not_active_modules, 0, 0));
$total_modules = do_sqlquery("SELECT COUNT(*) FROM {$TABLE_PREFIX}modules", true);
$admintpl->set("nr_total_modules", mysqli_result($total_modules, 0, 0));
$admintpl->set("form_action", "index.php?page=admin&user=" . $CURUSER["uid"] . "&code=" . $CURUSER["random"] . "&do=module_config&action=add");
break;
// end of case 'manage'
// end of case 'manage'
case 'change_to_yes':
$id = max(0, $_GET["id"]);
$admintpl->set("language", $language);
do_sqlquery("UPDATE {$TABLE_PREFIX}modules SET activated='yes', changed=NOW() WHERE id={$id}", true);
redirect("index.php?page=admin&user=" . $CURUSER["uid"] . "&code=" . $CURUSER["random"] . "&do=module_config&action=manage");
die;
break;
case 'change_to_no':
$id = max(0, $_GET["id"]);
$admintpl->set("language", $language);
do_sqlquery("UPDATE {$TABLE_PREFIX}modules SET activated='no', changed=NOW() WHERE id={$id}", true);