本文整理汇总了PHP中mysql_fetch_all函数的典型用法代码示例。如果您正苦于以下问题:PHP mysql_fetch_all函数的具体用法?PHP mysql_fetch_all怎么用?PHP mysql_fetch_all使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了mysql_fetch_all函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_windows
function get_windows()
{
global $NICKNAME;
$o = array();
$r = mysql_fetch_all(mysql_query("SELECT * FROM windows WHERE\n\t\tnickname ='{$NICKNAME}'"));
foreach ($r as $row) {
$o[] = $row['title'];
}
return $o;
}
示例2: csvData
function csvData($table, $state_name, $col, $key)
{
$query = 'SELECT ' . $col . ' FROM ' . $table . ' WHERE ' . $key . '="' . $state_name . '" LIMIT 1';
$query_result = mysqli_query($query);
if (!$query_result) {
die('Invalid query: ' . mysql_error());
}
$query_result = mysql_fetch_all($query_result);
//$query_result = str_replace("’","'",$query_result); //clean dirty characters
return $query_result[0][$col];
}
示例3: fetch_queue
function fetch_queue($NICKNAME, $window, $seen = FALSE, $limit = 200)
{
$r = mysql_fetch_all(mysql_query("SELECT * FROM queue WHERE nickname = '{$NICKNAME}' AND window = '{$window}' AND seen = " . ($seen ? 1 : 0) . " ORDER BY id DESC " . ($limit ? "LIMIT {$limit}" : "")));
$startid = $r[count($r) - 1]['id'];
$endid = $r[0]['id'];
if (!$seen) {
mysql_query("UPDATE queue SET seen = 1 WHERE nickname = '{$NICKNAME}' AND window = '{$window}' AND id >= '{$startid}' AND id <= '{$endid}'");
}
krsort($r);
return $r;
}
示例4: mail_entry
function mail_entry($to, $subject, $uri, $page)
{
$r = mysql_query("select * from debug where uri = '{$uri}'");
$r = mysql_fetch_all($r);
if (count($r) == 0) {
mail($to, $subject, $uri . "\n" . $page);
print "Mailing {$to} about it...\n";
mysql_query("insert into debug (uri) values('{$uri}')");
/*} else {
print("Already mailed $to\n");*/
}
}
示例5: get_messages
function get_messages($quals = NULL, $table = '')
{
global $messageboard_db, $messageboard_table;
if (!$messageboard_table) {
$messageboard_table = 'messages';
}
if (!$table) {
$ids = $quals;
if (!is_array($ids) or count($ids) == 0) {
return array();
}
} else {
unset($ids);
}
$q = "SELECT {$messageboard_table}.poster AS poster, {$messageboard_table}.subject AS subject,\n\t\t\t{$messageboard_table}.date AS date, {$messageboard_table}.body AS body\n\t\t\tFROM messages " . ($table ? ", {$table}" : "") . ($ids || $quals ? " WHERE " : "") . (is_array($ids) ? "{$messageboard_table}.messageid IN ('" . join("','", $ids) . "')" : "") . (is_array($quals) ? join(' AND ', $quals) : "") . " ORDER BY date";
print "<!-- {$q} -->";
return mysql_fetch_all(mysql_query($q, $messageboard_db));
}
示例6: get_cached_friends
function get_cached_friends($username, $limit = 0)
{
if (!$limit) {
$limit = JOURNAL_FRIENDSENTRIES;
}
$r = mysql_fetch_all(mysql_query("SELECT * FROM cache \n\t\t\t\tINNER JOIN friends ON (friends.uri = cache.friend_uri)\n\t\t\t\tWHERE friends.username = '{$username}' \n\t\t\t\tORDER BY cache.date DESC \n\t\t\t\tLIMIT {$limit}"));
foreach ($r as $key => $row) {
$r[$key]['data'] = $row['body'];
if (ereg('opendiary.com', $r[$key]['friend_uri'])) {
$r[$key]['friend'] .= '(OD)';
} elseif (ereg('diaryland.com', $r[$key]['friend_uri'])) {
$r[$key]['friend'] .= '(DL)';
} elseif (ereg('livejournal.com', $r[$key]['friend_uri'])) {
$r[$key]['friend'] .= '(LJ)';
}
unset($r[$key]['body']);
}
return $r;
}
示例7: cart_customer_new
function cart_customer_new($ci)
{
extract($ci);
$id = FALSE;
if (mysql_query("INSERT INTO customers (name) VALUES ('" . $shipping['name'] . "')")) {
if ($r = mysql_query("SELECT last_insert_id() AS id")) {
$r = mysql_fetch_all($r);
$id = $r[0]['id'];
extract($shipping);
if (!mysql_query("INSERT INTO addresses \n\t\t\t\t\t(type, customerid, name, address, phone) VALUES \n\t\t\t\t\t('shipping', '{$id}', '{$name}', '{$address}', '{$phone}')")) {
print mysql_error();
}
extract($billing);
if (!mysql_query("INSERT INTO addresses \n\t\t\t\t\t(type, customerid, name, address, phone) VALUES \n\t\t\t\t\t('billing', '{$id}', '{$name}', '{$address}', '{$phone}')")) {
print mysql_error();
}
} else {
print mysql_error();
}
} else {
print mysql_error();
}
return $id;
}
示例8: dirname
<?php
require_once dirname(__FILE__) . "/../string.php";
require_once dirname(__FILE__) . "/irc.php";
print "<meta http-equiv='refresh' content='15; URL=\"" . purlencode($PHP_SELF) . "?NICKNAME={$NICKNAME}\"' />";
$r = mysql_fetch_all(mysql_query("SELECT * FROM windows WHERE nickname = '{$NICKNAME}'"));
$w = get_windows();
foreach ($w as $window) {
$o .= td("<a href='{$SCRIPT_NAME}/Windows/" . purlencode($window) . "?NICKNAME={$NICKNAME}' target='window'>{$window}</a>");
}
$o .= td("<a href='{$SCRIPT_NAME}/Logoff?NICKNAME={$NICKNAME}' target='_top'>Log Off</a>");
$o .= td("<a href='{$PHP_SELF}?NICKNAME={$NICKNAME}'>Refresh</a>");
print table(tr($o));
示例9: fetchAll
public function fetchAll($result)
{
try {
if ($this->config->connector == "mysql") {
return mysql_fetch_all($result, MYSQLI_ASSOC);
} elseif ($this->config->connector == "mysqli") {
return mysqli_fetch_all($result, MYSQLI_ASSOC);
}
} catch (exception $e) {
return $e;
}
}
示例10: mysql_query
echo "<html>\n\t\t\t<head>\n \t\t\t<title>Chimi 1.0 - Print Schedule by Instructor</title>\n \t\t</head>\n \t<html>";
// get university name, semester details
$univ_result = mysql_query("SELECT * FROM University WHERE sessionID = '" . $sessionID . "'");
while ($university = mysql_fetch_assoc($univ_result)) {
echo "<br>";
echo "THE " . strtoupper($university['universityName']);
echo "<br>";
echo 'SEMESTER COURSE LISTING' . "<br><br>";
}
$building_result = mysql_query("SELECT * FROM Building WHERE sessionID='" . $sessionID . "'");
$buildings = mysql_fetch_all($building_result);
$dept_result = mysql_query("SELECT * FROM Department WHERE sessionID='" . $sessionID . "'");
$departments = mysql_fetch_all($dept_result);
for ($i = 0; $i < count($instructors); ++$i) {
$section_result = mysql_query("SELECT * FROM Section WHERE sessionID='" . $sessionID . "' AND instructorID='" . $instructors[$i]["instructorID"] . "'");
$sections = mysql_fetch_all($section_result);
echo $instructors[$i]["lastName"] . ", " . $instructors[$i]["firstName"];
echo "<br><br>";
start_schedule_table();
// only print the sections which belong to the containing department?
for ($j = 0; $j < count($sections); ++$j) {
$roomID = slotID_to_roomID($sections[$j]["slotID"], $num_of_slots_per_room);
$building = binary_search($buildings, "buildingID", $rooms[$roomID]["buildingID"]);
$course = binary_search($courses, "courseID", $sections[$j]["courseID"]);
$available = $sections[$j]["maxEnrollment"] - $sections[$j]["preliminaryEnrollment"];
$dayOfWeek = slotID_to_dayOfWeek($sections[$j]["slotID"], $num_of_slots_per_room, count($periods));
$period = get_period_from_slotID($sections[$j]["slotID"], $num_of_slots_per_room, $periods, count($periods));
$startTime = convert_int_to_standard_time($period["startTime"]);
$endTime = convert_int_to_standard_time($period["endTime"]);
echo "<tr>";
echo "<td>" . $building["buildingAbbr"] . "</td>";
示例11: trigger_error
}
if (!in_array($result_type, array(MYSQL_ASSOC, MYSQL_BOTH, MYSQL_NUM), true)) {
trigger_error(__FUNCTION__ . '(): result type should be MYSQL_NUM, MYSQL_ASSOC, or MYSQL_BOTH', E_USER_WARNING);
return false;
}
$rows = array();
while ($row = mysql_fetch_array($result, $result_type)) {
$rows[] = $row;
}
return $rows;
}
do {
mysql_select_db($database_homebank_conecta, $homebank_conecta);
$query_tipoacessomenu = "SELECT codmenu FROM acessomenutipo WHERE codtipo={$row_tipopermissao['id']}";
$tipoacessomenu = mysql_query($query_tipoacessomenu, $homebank_conecta) or die(mysql_error());
$row_tipoacessomenu = mysql_fetch_all($tipoacessomenu);
$array_column = array();
foreach ($row_tipoacessomenu as $key => $value) {
$array_column[] = $value['codmenu'];
}
$valores = implode(',', $array_column);
?>
<tr>
<td width="200" align="right" class="td3"><?php
echo $row_tipopermissao['descricao'];
?>
</td>
<td class="td4">
<input type="radio" name="tiposacessomenu" id="<?php
echo $valores;
?>
示例12: get_user_name
}
if (count($result) == 0) {
return $default_value;
}
return $result;
}
function get_user_name($userid)
{
$res = sql_query("SELECT `username` , `id` , `class`, `chatpost`, `leechwarn`, `warned`, `pirate`, `king`, `donor`, `enabled` FROM `users` WHERE `id` = {$userid} LIMIT 1") or sqlerr(__FILE__, __LINE__);
$username = mysql_fetch_assoc($res);
return $username;
}
$count1 = get_row_count('events');
$perpage = 15;
$pager = pager($perpage, $count1, 'staffpanel.php?tool=events&action=events&');
$scheduled_events = mysql_fetch_all("SELECT * from `events` ORDER BY `startTime` DESC " . $pager['limit'] . ";", array());
if (is_array($scheduled_events)) {
foreach ($scheduled_events as $scheduled_event) {
if (is_array($scheduled_event) && array_key_exists('startTime', $scheduled_event) && array_key_exists('endTime', $scheduled_event)) {
$startTime = 0;
$endTime = 0;
$overlayText = "";
$displayDates = true;
$startTime = $scheduled_event['startTime'];
$endTime = $scheduled_event['endTime'];
if (time() < $endTime && time() > $startTime) {
if (array_key_exists('overlayText', $scheduled_event)) {
$overlayText = $scheduled_event['overlayText'];
}
if (!is_string($overlayText)) {
$overlayText = "";
示例13: mysql_connect
}
if (!$error) {
// only proceed if there is no error
$conn = mysql_connect($servername, $username, $password);
mysql_select_db($database_name, $conn);
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
$idPart = " ";
if ($id != "*") {
$idPart = "AND cdi.id = {$id}";
}
$sql = "SELECT cdi.uuid,UNIX_TIMESTAMP(cdt.last_seen)*1000 as last_seen, cdt.status\n\t\t\tFROM {$table_device_timing} cdt, {$table_device_info} cdi\n\t\t\tWHERE (last_seen BETWEEN '" . $from . "' AND '" . $to . "')\n\t\t\t{$idPart}\n\t\t\tAND cdi.id = cdt.tid \n\t\t\tAND char_length( cdi.uuid ) <= 17\n\t\t\tORDER BY cdt.tid,cdt.last_seen ASC";
// die($sql);
$query = mysql_query($sql) or die(mysql_error() . $sql);
$query = mysql_fetch_all($query, MYSQL_ASSOC);
if (count($query) <= 0 || !$query) {
// empty result
$error = true;
$result['error'] = 'No result found in database';
$result['solution'] = 'Try a different date';
} else {
$result['result'] = $query;
$result['sucess'] = true;
}
mysql_close();
echo json_encode($result);
} else {
echo json_encode($error_array);
}
} else {
示例14: while
require_once '../app/functions.php';
while (true) {
$conn = mysql_connect($servername, $username, $password);
mysql_select_db($database_name, $conn);
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
if (!mysql_set_charset('utf8', $conn)) {
echo "Error: Unable to set the character set.\n";
exit;
}
$devicesInfoInDatabase = mysql_query("Select distinct(uuid) from {$table_device_info} WHERE LENGTH(uuid)<18");
if (!$devicesInfoInDatabase) {
die('Invalid query: ' . mysql_error());
}
$devicesInfoInDatabase = mysql_fetch_all($devicesInfoInDatabase, MYSQL_ASSOC);
// filter just to get db
$dbDevices = array();
foreach ($devicesInfoInDatabase as $dbDevice) {
array_push($dbDevices, $dbDevice['uuid']);
}
// die(var_dump($dbDevices));
$databaseMatchingDevices = array();
$lostDevices = array();
//registered devices that are not online anymore
$newDevices = array();
// new devices in the network
$result = $pubnub->hereNow(null, false, true);
$connectedDevices = $result['payload']['channels'];
// $onlineDevices = $connectedDevices['connect']['uuids'];
/*First iteration check if the online devices exists in the database*/
示例15: sidebars
<?php
if ($REQUEST_METHOD == 'POST') {
if ($data) {
$q = "REPLACE INTO sidebars (title, data, username) \n\t\t\t\tVALUES ('{$sidebar}', '{$data}', '" . JOURNAL_USERNAME . "')";
if (mysql_query($q)) {
print "Updated.";
} else {
print mysql_error();
}
} else {
print "You have to enter /something/.";
}
} else {
$r = mysql_fetch_all(mysql_query("SELECT * FROM sidebars WHERE username = '" . JOURNAL_USERNAME . "' \n\t\t\t\tAND title = '{$sidebar}'"));
extract($r[0]);
print "<form action='{$PHP_SELF}' method='POST'>";
print table(row1(heading(2, $sidebar)) . row1(textarea('data', $data)) . row1("<input type='submit' value='Add' />"));
print "</form>";
}