本文整理汇总了PHP中mysql_fetch_row函数的典型用法代码示例。如果您正苦于以下问题:PHP mysql_fetch_row函数的具体用法?PHP mysql_fetch_row怎么用?PHP mysql_fetch_row使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了mysql_fetch_row函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _icl_ts_mysqldump
function _icl_ts_mysqldump($mysql_database)
{
global $wpdb;
$upload_folder = wp_upload_dir();
$dump_tmp_file = $upload_folder['path'] . '/' . '__icl_mysqldump.sql';
$fp = @fopen($dump_tmp_file, 'w');
if (!$fp) {
$fp = fopen('php://output', 'w');
ob_start();
}
$sql = "SHOW TABLES LIKE '" . str_replace('_', '\\_', $wpdb->prefix) . "%';";
$result = mysql_query($sql);
if ($result) {
while ($row = mysql_fetch_row($result)) {
//_icl_ts_mysqldump_table_structure($row[0]);
//_icl_ts_mysqldump_table_data($row[0]);
_icl_ts_backup_table($row[0], 0, $fp);
}
} else {
echo "/* no tables in {$mysql_database} */\n";
}
mysql_free_result($result);
fclose($fp);
if (file_exists($dump_tmp_file)) {
$data = file_get_contents($dump_tmp_file);
@unlink($dump_tmp_file);
} else {
$data = ob_get_contents();
ob_end_clean();
}
return $data;
}
示例2: fetch_data
function fetch_data()
{
global $include_path;
global $PMBuserid;
$this->info = array();
$this->users = array();
$requete_users = "SELECT userid, username FROM users order by username ";
$res_users = mysql_query($requete_users);
$this->all_users = array();
while (list($this->all_userid, $all_username) = mysql_fetch_row($res_users)) {
$this->all_users[] = array($this->all_userid, $all_username);
}
if (!$this->id) {
$this->users[] = $PMBuserid;
return;
}
$req = "select * from mailtpl where id_mailtpl=" . $this->id;
$resultat = mysql_query($req);
if (mysql_num_rows($resultat)) {
$r = mysql_fetch_object($resultat);
$this->info['id'] = $r->id_mailtpl;
$this->info['name'] = $r->mailtpl_name;
$this->info['objet'] = $r->mailtpl_objet;
$this->info['tpl'] = $r->mailtpl_tpl;
$this->info['users'] = $r->mailtpl_users;
}
$this->users = explode(" ", $this->info['users']);
// printr($this->info[28]);
}
示例3: changePassword
function changePassword($username, $currentpassword, $newpassword, $newpassword2)
{
global $seed;
if (!valid_username($username) || !user_exists($username)) {
return false;
}
if (!valid_password($newpassword) || $newpassword != $newpassword2) {
return false;
}
// we get the current password from the database
$query = sprintf("SELECT password FROM login WHERE username = '%s' LIMIT 1", mysql_real_escape_string($username));
$result = mysql_query($query);
$row = mysql_fetch_row($result);
// compare it with the password the user entered, if they don't match, we return false, he needs to enter the correct password.
if ($row[0] != sha1($currentpassword . $seed)) {
return false;
}
// now we update the password in the database
$query = sprintf("update login set password = '%s' where username = '%s'", mysql_real_escape_string(sha1($newpassword . $seed)), mysql_real_escape_string($username));
if (mysql_query($query)) {
return true;
} else {
return false;
}
return false;
}
示例4: getLoveHistory
public function getLoveHistory($page, $justUser = false)
{
$front = Frontend::getInstance();
$page--;
$l = $this->getLimit() * $page;
$where = '';
$sql = "SELECT count(*) " . "FROM " . LOVE_LOVE;
$res = mysql_query($sql);
$row = mysql_fetch_row($res);
$loves = $row[0];
$sql = "SELECT count(*) " . "FROM " . LOVE_LOVE . " " . "WHERE " . LOVE_LOVE . ".receiver = '" . $front->getUser()->getUsername() . "' " . "OR " . LOVE_LOVE . ".giver = '" . $front->getUser()->getUsername() . "' " . ($sql .= $justUser ? '' : "OR " . LOVE_LOVE . ".company_id = '" . $front->getUser()->getCompany_id() . "' ");
$sql .= $where . " " . "ORDER BY id DESC";
$res = mysql_query($sql);
$row = mysql_fetch_row($res);
$count = $row[0];
$cPages = ceil($count / $this->getLimit());
$sql = "SELECT id,giver,receiver,why,private,TIMESTAMPDIFF(SECOND,at,NOW()) as delta " . "FROM " . LOVE_LOVE . " " . "WHERE " . LOVE_LOVE . ".receiver = '" . $front->getUser()->getUsername() . "' " . "OR " . LOVE_LOVE . ".giver = '" . $front->getUser()->getUsername() . "' ";
$sql .= $justUser ? '' : "OR " . LOVE_LOVE . ".company_id = '" . $front->getUser()->getCompany_id() . "' ";
$sql .= $where . " " . "ORDER BY id DESC " . "LIMIT " . $l . "," . $this->getLimit();
$res = mysql_query($sql);
// Construct json for history
$this->pages = array(array($page, $cPages, number_format($loves)));
for ($i = 1; $row = mysql_fetch_assoc($res); $i++) {
$givernickname = getNickName($row['giver']);
$givernickname = !empty($givernickname) ? $givernickname : $row['giver'];
$receivernickname = getNickName($row['receiver']);
$receivernickname = !empty($receivernickname) ? $receivernickname : $row['receiver'];
$why = $row['why'];
if ($row['private']) {
$why .= " (love sent quietly)";
}
$history[] = array("id" => $row['id'], "giver" => $row['giver'], "giverNickname" => $givernickname, "receiver" => $row['receiver'], "receiverNickname" => $receivernickname, "why" => $why, "delta" => Utils::relativeTime($row['delta']));
}
return $history;
}
示例5: show_abts
function show_abts($dbh)
{
global $msg;
global $charset;
print "<table>\n\t\t<tr>\n\t\t<th>" . $msg[103] . "</th>\n\t\t<th style='display:none'>" . $msg["type_abts_prepay"] . "</th>\n\t\t<th style='display:none'>" . $msg["type_abts_prepay_dflt"] . "</th>\n\t\t<th>" . $msg["type_abts_tarif"] . "</th>\n\t\t<th>" . $msg["type_abts_caution"] . "</th>\n\t\t</tr>";
// affichage du tableau des utilisateurs
$requete = "SELECT id_type_abt, type_abt_libelle, prepay, prepay_deflt_mnt,tarif,caution FROM type_abts ORDER BY type_abt_libelle,id_type_abt";
$res = mysql_query($requete, $dbh);
$nbr = mysql_num_rows($res);
$parity = 1;
for ($i = 0; $i < $nbr; $i++) {
$row = mysql_fetch_row($res);
if ($row[2]) {
$prepay = "x";
}
if ($parity % 2) {
$pair_impair = "even";
} else {
$pair_impair = "odd";
}
$parity += 1;
$tr_javascript = " onmouseover=\"this.className='surbrillance'\" onmouseout=\"this.className='{$pair_impair}'\" onmousedown=\"document.location='./admin.php?categ=finance&sub=abts&action=modif&id={$row['0']}';\" ";
print pmb_bidi("<tr class='{$pair_impair}' {$tr_javascript} style='cursor: pointer'><td>" . htmlentities($row[1], ENT_QUOTES, $charset) . "</td>\n\t\t\t<td style='text-align:center;display:none'>{$prepay}</td><td style='display:none'>" . $row[3] . "</td><td>" . $row[4] . "</td><td>" . $row[5] . "</td>\n\t\t\t\t\t\t</tr>");
}
print "</table>\n\t\t<input class='bouton' type='button' value=\" " . $msg["type_abts_add"] . " \" onClick=\"document.location='./admin.php?categ=finance&sub=abts&action=add'\" />";
}
示例6: loadInfo
protected function loadInfo($vf1965a857bc285d26fe22023aa5ab50d = false)
{
if ($vf1965a857bc285d26fe22023aa5ab50d === false) {
$vac5c74b64b4b8352ef2f181affb5ac2a = "SELECT id, name, data_type, is_multiple, is_unsigned FROM cms3_object_field_types WHERE id = '{$this->id}'";
$result = l_mysql_query($vac5c74b64b4b8352ef2f181affb5ac2a);
if ($v56bd7107802ebe56c6918992f0608ec6 = l_mysql_error()) {
throw new coreException($v56bd7107802ebe56c6918992f0608ec6);
return false;
}
$vf1965a857bc285d26fe22023aa5ab50d = mysql_fetch_row($result);
}
if (list($vb80bb7740288fda1f201890375a60c8f, $vb068931cc450442b63f5b3d276ea4297, $v17f71d965fe9589ddbd11caf7182243e, $v96a76ec43956dac431b643cbd544dd08, $vf089d93c2ef0d088edadddb0028d548d) = $vf1965a857bc285d26fe22023aa5ab50d) {
if (!self::isValidDataType($v17f71d965fe9589ddbd11caf7182243e)) {
throw new coreException("Wrong data type given for filed type #{$this->id}");
return false;
}
$this->name = $vb068931cc450442b63f5b3d276ea4297;
$this->data_type = $v17f71d965fe9589ddbd11caf7182243e;
$this->is_multiple = (bool) $v96a76ec43956dac431b643cbd544dd08;
$this->is_unsigned = (bool) $vf089d93c2ef0d088edadddb0028d548d;
return true;
} else {
return false;
}
}
示例7: AddItem
function AddItem($bookId, $container)
{
//This create an error
//function can not detect connection
$dbUser = "root";
$dbPass = "";
$dbName = "libraryDB";
$dbServer = "127.0.0.1";
// Connect to the database and return
// true/false depending on whether or
// not a connection could be made.
$s = mysql_connect($dbServer, $dbUser, $dbPass);
$d = mysql_select_db($dbName, $s);
$result = mysql_query("select count(*) from list where cookieId = '" . bookListId() . "' and bookId = {$bookId}");
$row = mysql_fetch_row($result);
$numRows = $row[0];
if ($numRows == 0) {
// This item doesn't exist in the users cart,
// we will add it with an insert query
//This also creates an error
//Is the problem that it can't access to the database?
mysql_query("insert into list(cookieId, bookId, container) values('" . bookListId() . "', {$bookId}, {$container})");
} else {
// This item already exists in the users cart,
// we will update it instead
print "Book already exists! ";
echo "<br>";
}
}
示例8: fetch_row
function fetch_row()
{
if (!$this->result) {
die("Query not executed<br>");
}
return mysql_fetch_row($this->result);
}
示例9: update_gateway_fee2
function update_gateway_fee2($vars)
{
$invoice = mysql_fetch_row(mysql_query("SELECT `userid` FROM `tblinvoices` WHERE `id`='" . $vars[invoiceid] . "'"));
$user = mysql_fetch_row(mysql_query("SELECT `currency` FROM `tblclients` WHERE `id`='" . $invoice[0] . "'"));
$currency = mysql_fetch_row(mysql_query("SELECT `code` FROM `tblcurrencies` WHERE `id`='" . $user[0] . "'"));
$paymentmethod = $vars['paymentmethod'];
delete_query("tblinvoiceitems", "invoiceid='" . $vars[invoiceid] . "' and notes='gateway_fees'");
$result = select_query("tbladdonmodules", "setting,value", "setting='fee_2_" . $vars['paymentmethod'] . '_' . $currency[0] . "' or setting='fee_1_" . $vars[paymentmethod] . '_' . $currency[0] . "'");
while ($data = mysql_fetch_array($result)) {
$params[$data['setting']] = $data['value'];
}
$fee1 = $params['fee_1_' . $paymentmethod . '_' . $currency[0]];
$fee2 = $params['fee_2_' . $paymentmethod . '_' . $currency[0]];
$total = InvoiceTotal($vars['invoiceid']);
if ($total > 0) {
$amountdue = $fee1 + $total * $fee2 / 100;
if ($fee1 > 0 & $fee2 > 0) {
$d = $fee1 . '+' . $fee2 . "%";
} elseif ($fee2 > 0) {
$d = $fee2 . "%";
} elseif ($fee1 > 0) {
$d = $fee1;
}
}
if ($d) {
insert_query("tblinvoiceitems", array("userid" => $_SESSION['uid'], "invoiceid" => $vars[invoiceid], "type" => "Fee", "notes" => "gateway_fees", "description" => getGatewayName2($vars['paymentmethod']) . " комиссия ({$d}) в " . $currency[0], "amount" => $amountdue, "taxed" => "0", "duedate" => "now()", "paymentmethod" => $vars[paymentmethod]));
}
updateInvoiceTotal($vars[invoiceid]);
}
示例10: resul
function resul($s = false)
{
if ($s === false) {
$s = $this->result;
}
return mysql_fetch_row($s);
}
示例11: exec_query
function exec_query($gl_type, $sku)
{
$query = "SELECT SUM(`qty`) FROM `journal_item` where `gl_type` = '" . $gl_type . "' and `sku` = '" . $sku . "'";
$resu = mysql_query($query);
$cant = mysql_fetch_row($resu);
return $cant[0];
}
示例12: datadump
function datadump($table)
{
// <--- thx to mrwebmaster for function
# Creo la variabile $result
$result .= "# Dump of {$table} \n";
$result .= "# Dump DATE : " . date("d-M-Y") . "\n\n";
# Conto i campi presenti nella tabella
$query = mysql_query("select * from {$table}");
$num_fields = @mysql_num_fields($query);
# Conto il numero di righe presenti nella tabella
$numrow = mysql_num_rows($query);
# Passo con un ciclo for tutte le righe della tabella
for ($i = 0; $i < $numrow; $i++) {
$row = mysql_fetch_row($query);
# Ricreo la tipica sintassi di un comune Dump
$result .= "INSERT INTO " . $table . " VALUES(";
# Con un secondo ciclo for stampo i valori di tutti i campi
# trovati in ogni riga
for ($j = 0; $j < $num_fields; $j++) {
$row[$j] = addslashes($row[$j]);
$row[$j] = ereg_replace("\n", "\\n", $row[$j]);
if (isset($row[$j])) {
$result .= "\"{$row[$j]}\"";
} else {
$result .= "\"\"";
}
if ($j < $num_fields - 1) {
$result .= ",";
}
}
# Chiudo l'istruzione INSERT
$result .= ");\n";
}
return $result . "\n\n\n";
}
示例13: getCol
public function getCol($col = 0)
{
while ($row = mysql_fetch_row($this->queryResult)) {
$result[] = $row[$col];
}
return $result;
}
示例14: check_login
function check_login($user_id, $password)
{
session_destroy();
session_start();
$moodle_host = "127.0.0.1";
$moodle_port = "3306";
$moodle_user = "root";
$moodle_db = "moodle";
$moodle_pass = "";
$moodle_conn = mysql_connect($moodle_host . ":" . $moodle_port, $moodle_user, $moodle_pass);
$moodle_salt = '-Y9-h0;),c@<i)D~*i/j7.pD6lh/,B';
$password = md5($password . $moodle_salt);
$ret = false;
$moodle_pre = "mdl_";
$sql = "select password from " . $moodle_pre . "user where username='" . mysql_real_escape_string($user_id) . "'";
if ($moodle_conn) {
mysql_select_db($moodle_db, $moodle_conn);
$result = mysql_query($sql, $moodle_conn);
$row = mysql_fetch_row($result);
if ($row && $password == $row[0]) {
$ret = $user_id;
}
}
return $ret;
}
示例15: count_active_games
public function count_active_games()
{
$sql = "\r\n\t\t\tSELECT COUNT(*)\r\n\t\t\tFROM `games`\r\n\t\t\tWHERE `games`.`status` = 'active'\r\n\t\t\t AND (`games`.`active_user_id` = {$this->id} OR `games`.`inactive_user_id` = {$this->id})\r\n\t\t";
$result = mysql_query($sql) or die('arjsdfjdj' . mysql_error());
$row = mysql_fetch_row($result);
return $row[0];
}