本文整理汇总了PHP中SQL::fetchAssoc方法的典型用法代码示例。如果您正苦于以下问题:PHP SQL::fetchAssoc方法的具体用法?PHP SQL::fetchAssoc怎么用?PHP SQL::fetchAssoc使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SQL
的用法示例。
在下文中一共展示了SQL::fetchAssoc方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getList
public function getList()
{
$result = SQL::query("SELECT * FROM users;");
$response = array();
for ($i = 0; $i < $result->num_rows; $i++) {
$line = SQL::fetchAssoc($result);
array_push($response, $line);
}
return $response;
}
示例2: getList
public function getList()
{
$userId = $_SESSION["userId"];
$result = SQL::query("SELECT * FROM foods WHERE user_id = " . $userId . ";");
$response = array();
for ($i = 0; $i < $result->num_rows; $i++) {
$line = SQL::fetchAssoc($result);
array_push($response, $line);
}
return $response;
}
示例3: getList
public function getList()
{
$food = new Food();
$userId = $_SESSION["userId"];
$result = SQL::query("SELECT * FROM calories WHERE user_id = " . $userId . ";");
$response = array();
for ($i = 0; $i < $result->num_rows; $i++) {
$line = SQL::fetchAssoc($result);
$foodData = $food->getById($line["food_id"]);
$line["food_data"] = $foodData;
array_push($response, $line);
}
return $response;
}
示例4: substr
}
// unique identifer for this session, to validate ajax requests.
// document root is included because it is likely a difficult value
// for potential attackers to guess
$requestKey = substr(md5(session_id() . $_SERVER["DOCUMENT_ROOT"]), 0, 16);
if (isset($conn) && $conn->isConnected()) {
if (isset($_GET['db'])) {
$db = $conn->escapeString($_GET['db']);
}
if (isset($_GET['table'])) {
$table = $conn->escapeString($_GET['table']);
}
if ($conn->hasCharsetSupport()) {
$charsetSql = $conn->listCharset();
if ($conn->isResultSet($charsetSql)) {
while ($charsetRow = $conn->fetchAssoc($charsetSql)) {
$charsetList[] = $charsetRow['Charset'];
}
}
$collationSql = $conn->listCollation();
if ($conn->isResultSet($collationSql)) {
while ($collationRow = $conn->fetchAssoc($collationSql)) {
$collationList[$collationRow['Collation']] = $collationRow['Charset'];
}
}
}
}
// undo magic quotes, if necessary
if (get_magic_quotes_gpc()) {
$_GET = stripslashesFromArray($_GET);
$_POST = stripslashesFromArray($_POST);
示例5: get
public function get()
{
$result = SQL::query("SELECT daily_calories FROM users WHERE id = '" . $_SESSION["userId"] . "' LIMIT 1;");
return SQL::fetchAssoc($result);
}