本文整理汇总了PHP中mysql_result函数的典型用法代码示例。如果您正苦于以下问题:PHP mysql_result函数的具体用法?PHP mysql_result怎么用?PHP mysql_result使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了mysql_result函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: findTrackData
function findTrackData($delta, $pic_time, $datum, $pic_id)
{
//Bestimmung des Trackpunktes mit der kleinsten zeitlichen Abweichung vom Aufnahme-Zeitpunkt:
include '../../share/global_config.php';
include $sr . '/bin/share/db_connect1.php';
if (!isset($i10)) {
$i10 = 0;
}
$delta = $delta - 1;
$start_time = date('H:i:s', strtotime("{$pic_time} - {$delta} seconds"));
$end_time = date('H:i:s', strtotime("{$pic_time} + {$delta} seconds"));
//echo "Zeitgrenzen fuer Trackdaten: ".$start_time." - ".$end_time."<BR>";
$result8 = mysql_query("SELECT * FROM {$table13} WHERE date = '{$datum}' AND (time = '{$start_time}' OR time = '{$end_time}')");
$num8 = mysql_num_rows($result8);
//Wenn mehrere Trackpunkte gefunden werden, werden willkuerlich die Daten des ersten verwendet:
$longitude = mysql_result($result8, 0, 'longitude');
$latitude = mysql_result($result8, 0, 'latitude');
$altitude = mysql_result($result8, 0, 'altitude');
//in der 'locations' gespeichert und mit dem Bild 'pic_id' verknuepft:
$result9 = mysql_query("INSERT INTO {$table12} (longitude, latitude, altitude) VALUES ('{$longitude}', '{$latitude}', '{$altitude}')");
echo mysql_error();
$result10 = mysql_query("SELECT max(loc_id) FROM {$table12}");
$loc_id = mysql_result($result10, $i10, 'max(loc_id)');
//echo "<".$loc_id." >";
$result11 = mysql_query("UPDATE {$table2} SET loc_id = '{$loc_id}' WHERE pic_id = '{$pic_id}'");
}
示例2: selectrec
function selectrec($fields, $table, $cond = "")
{
$a = array();
$query = "select " . $fields . " from " . $table;
if (!($cond == "")) {
$query = $query . " where " . $cond;
}
//echo "<br>".$query;
$result = mysql_query($query);
//echo mysql_error();
//if (mysql_error()!="")
//echo "<br>".$query;
$numrows = mysql_num_rows($result);
$numfields = mysql_num_fields($result);
$i = $j = 0;
while ($i < $numrows) {
while ($j < $numfields) {
$a[$i][$j] = mysql_result($result, $i, mysql_field_name($result, $j));
$j++;
}
$i++;
$j = 0;
}
mysql_free_result($result);
return $a;
}
示例3: seleccionar_valor_condicion
public function seleccionar_valor_condicion($columna, $fila, $condicion, $c_valor)
{
$consulta = mysql_result(mysql_query("SELECT {$columna} FROM {$fila} WHERE {$condicion}='" . $c_valor . "' ", $this->link), 0);
echo $consulta;
mysql_free_result($consulta);
mysql_close($this->link);
}
示例4: upd_last_cast
function upd_last_cast($pl, $spell)
{
//$pl = preg_replace ('/[^a-z0-9_]/i', '', $pl);
//$spell = preg_replace ('/[^a-z0-9_]/i', '', $spell);
$now = time();
$id = is_player($pl);
if (!$id) {
put_error('npc cant cast spell');
}
$q = do_mysql("SELECT last FROM players WHERE id_player = '" . $id . "';");
$last = mysql_result($q, 0);
$last = explode('|', $last);
// vremja zaklinanija:
$q = do_mysql("SELECT timewait FROM magic WHERE fullname = '" . $spell . "';");
if (!mysql_num_rows($q)) {
put_error('there are no such spell: ' . $spell . '');
}
$tw = mysql_result($q, 0);
$last[3] = $now + $tw;
// obrabotka effektami:
#include_once ('modules/f_get_affected.php');
// effecty:
#$aff = get_affected ($LOGIN);
// primer: if (is_in ('oglushen', $aff)) $last[3] += 10;
$nlast = $last[0] . '|' . $last[1] . '|' . $last[2] . '|' . $last[3] . '|' . $last[4] . '|' . $last[5] . '|' . $last[6] . '|' . $last[7] . '|' . $last[8];
do_mysql("UPDATE players SET last = '" . $nlast . "' WHERE id_player = '" . $id . "';");
return 1;
}
示例5: Login
/**
* Logs this stake leader into the session given username and password
* @var $eml = The email address
* @var $pwd = The plaintext password (will be salted and hashed)
* @return If successful, the StakeLeader object. Otherwise null.
*/
public static function Login($eml, $pwd)
{
// Sanitize input
$eml = DB::Safe($eml);
// First, we need to obtain this stake leader's unique salt
$r = DB::Run("SELECT `Salt` FROM `Credentials` WHERE `Email`='{$eml}' AND `StakeLeaderID` > 0 LIMIT 1");
if (mysql_num_rows($r) == 0) {
return null;
}
$salt = mysql_result($r, 0);
// Now hash input according to our hashing algorithm and leader's salt
$pwd = hashPwd($pwd, $salt);
// See if the email/password combination are correct
$try = DB::Run("SELECT StakeLeaderID FROM Credentials WHERE Email='{$eml}' AND Password='{$pwd}' AND StakeLeaderID > 0 LIMIT 1");
if (mysql_num_rows($try) == 0) {
return null;
}
// At this point, valid credentials were entered. Proceed...
$stakeLeaderID = mysql_result($try, 0);
$stakeLeader = StakeLeader::Load($stakeLeaderID);
// Update LastActivity
$stakeLeader->UpdateLastActivity();
// Since they've logged in, no more need for existing
// password reset tokens. Delete any strays for security.
$q = "DELETE FROM PwdResetTokens WHERE CredentialsID={$stakeLeader->CredentialsID()}";
DB::Run($q);
// Save the session. This is the actual "logging in" part.
session_regenerate_id();
// Helps prevent session hijacking
$_SESSION["stakeLeaderID"] = $stakeLeaderID;
$_SESSION["timestamp"] = time();
$_SESSION["ipaddress"] = $_SERVER['REMOTE_ADDR'];
return $stakeLeader;
}
示例6: affichage_liste_bulletins_normale
function affichage_liste_bulletins_normale($res)
{
global $charset, $dbh;
while ($tableau = mysql_fetch_array($res)) {
$sql = "SELECT COUNT(1) FROM explnum WHERE explnum_bulletin='" . $tableau["bulletin_id"] . "'";
$result = @mysql_query($sql, $dbh);
$count = mysql_result($result, 0, 0);
print "<span class='liste_bulletins'>";
if ($count) {
$padding = "";
print '<img src="./images/attachment.png">';
} else {
$padding = "style=\"padding-left:11px;\"";
}
print "<a href=./index.php?lvl=bulletin_display&id=" . $tableau['bulletin_id'] . " " . $padding . ">" . $tableau['bulletin_numero'];
if ($tableau['mention_date']) {
print pmb_bidi(" (" . $tableau['mention_date'] . ")\n");
} elseif ($tableau['date_date']) {
print pmb_bidi(" (" . formatdate($tableau['date_date']) . ")\n");
}
if ($tableau['bulletin_titre']) {
print pmb_bidi(" : " . htmlentities($tableau['bulletin_titre'], ENT_QUOTES, $charset) . "\n");
}
print "</a> ;";
print "</span>\n";
}
}
示例7: displayBannedUsers
/**
* displayBannedUsers - Displays the banned users
* database table in a nicely formatted html table.
*/
function displayBannedUsers(){
global $database;
$q = "SELECT username,timestamp "
."FROM ".TBL_BANNED_USERS." ORDER BY username";
$result = $database->query($q);
/* Error occurred, return given name by default */
$num_rows = mysql_numrows($result);
if(!$result || ($num_rows < 0)){
echo "Error displaying info";
return;
}
if($num_rows == 0){
echo "Database table empty";
return;
}
/* Display table contents */
echo "<table align=\"left\" border=\"1\" cellspacing=\"0\" cellpadding=\"3\">\n";
echo "<tr><td><b>Username</b></td><td><b>Time Banned</b></td></tr>\n";
for($i=0; $i<$num_rows; $i++){
$uname = mysql_result($result,$i,"username");
$time = mysql_result($result,$i,"timestamp");
echo "<tr><td>$uname</td><td>$time</td></tr>\n";
}
echo "</table><br>\n";
}
示例8: Siguiente_Etapa
public function Siguiente_Etapa($etapa)
{
$query = sprintf("select et_siguiente_etapa from etapas where et_id=%s", $etapa);
$rst = parent::consultar($query);
$etapa = mysql_result($rst, 0, 0);
return $etapa;
}
示例9: index
public function index()
{
if ($this->session->userdata("login_id") == '') {
redirect("login");
}
if ($this->input->post("post_create_ad")) {
$this->postad_property_model->postad_creat();
}
$data = array("property_residential" => $this->category_model->property_residential(), "property_commercial" => $this->category_model->property_commercial(), "title" => "Classifieds", "content" => "postad_create_property");
$cat = $this->input->post('property_cat');
$sub_cat = $this->input->post('property_sub');
$sub_sub_cat = $this->input->post('property_sub_sub');
$sub_name = @mysql_result(mysql_query("SELECT * FROM `sub_category` WHERE sub_category_id = '{$sub_cat}'"), 0, 'sub_category_name');
$sub_sub_name = @mysql_result(mysql_query("SELECT * FROM `sub_subcategory` WHERE `sub_subcategory_id` = '{$sub_sub_cat}'"), 0, 'sub_subcategory_name');
if ($sub_name == '') {
redirect('post-a-deal');
}
$data['cat'] = $cat;
$data['sub_name'] = $sub_name;
$data['sub_sub_name'] = $sub_sub_name;
/*id for category*/
$data['sub_id'] = $sub_cat;
$data['sub_sub_id'] = $sub_sub_cat;
$data['login_id'] = $this->session->userdata("login_id");
$data['package_name'] = $this->category_model->package_name();
$data['free_pkg_list'] = $this->category_model->free_pkg_list();
$data['gold_pkg_list'] = $this->category_model->gold_pkg_list();
$data['ptm_pkg_list'] = $this->category_model->ptm_pkg_list();
$data['urgentlabel1'] = $this->category_model->urgentlabel1();
$data['urgentlabel2'] = $this->category_model->urgentlabel2();
$data['urgentlabel3'] = $this->category_model->urgentlabel3();
$data['free_likes'] = $this->category_model->free_likes();
$data['gold_likes'] = $this->category_model->gold_likes();
$this->load->view("classified_layout/inner_template", $data);
}
示例10: decr_abstr_misc
function decr_abstr_misc($prot, $who, $count, $other = 0)
{
//$prot = preg_replace ('/[^a-z0-9_\.]/i', '', $prot);
$count = preg_replace('/[^0-9]/', '', $count);
//$who = preg_replace ('/[^a-z0-9_]/i', '', $who);
if (!is_player($who)) {
return 0;
}
if ($count < 1) {
return 0;
}
$q = do_mysql("SELECT on_take FROM items WHERE belongs = '" . $who . "' AND is_in = 'inv' AND realname = '" . $prot . "' AND type = 'm';");
if (!mysql_num_rows($q)) {
return 0;
}
$ci = mysql_result($q, 0);
if ($ci < $count) {
return 0;
}
$ci -= $count;
if ($ci) {
do_mysql("UPDATE items SET on_take = '" . $ci . "' WHERE belongs = '" . $who . "' AND is_in = 'inv' AND realname = '" . $prot . "';");
} else {
include_once 'modules/f_delete_item.php';
$q = do_mysql("SELECT fullname FROM items WHERE belongs = '" . $who . "' AND is_in = 'inv' AND realname = '" . $prot . "' AND type = 'm';");
$item = mysql_result($q, 0);
delete_item($item);
}
return 1;
}
示例11: login
function login($username, $password)
{
$user_id = user_id_from_username($username);
$username = sanitize($username);
$password = md5($password);
return mysql_result(mysql_query("SELECT COUNT(user_id) FROM users WHERE username = '{$username}' AND password = '{$password}'"), 0) == 1 ? $user_id : false;
}
示例12: user_role
function user_role($username)
{
$username = sanitize($username);
$query = mysql_query("SELECT Role FROM user WHERE Username = '{$username}'");
$result = mysql_result($query, 0);
return $result;
}
示例13: predict
function predict($userID, $itemID)
{
global $connection;
$denom = 0.0;
//denominator
$numer = 0.0;
//numerator
$k = $itemID;
$sql = "SELECT r.itemID, r.ratingValue FROM rating r WHERE r.userID='" . $userID . "' AND r.itemID <> '" . $itemID . "'";
$db_result = mysql_query($sql);
//for all items the user has rated
while ($row = mysql_fetch_assoc($db_result)) {
$j = $row["itemID"];
$ratingValue = $row["ratingValue"];
//get the number of times k and j have both been rated by the same user
$sql2 = "SELECT d.count, d.sum FROM dev d WHERE itemID1={$k} AND itemID2={$j}";
$count_result = mysql_query($sql2, $connection);
//skip the calculation if it isn't found
if (mysql_num_rows($count_result) > 0) {
$count = mysql_result($count_result, 0, "count");
$sum = mysql_result($count_result, 0, "sum");
//calculate the average
$average = $sum / $count;
//increment denominator by count
$denom += $count;
//increment the numerator
$numer += $count * ($average + $ratingValue);
}
}
if ($denom == 0) {
return 0;
} else {
return $numer / $denom;
}
}
示例14: login
function login($username, $password)
{
$user_id = user_id_from_username($username);
$username = sanitize($username);
$password = hash('sha512', $password);
return mysql_result(mysql_query("SELECT COUNT(`user_id`) FROM `bplay_users` WHERE `username`='{$username}' AND `password`='{$password}'"), 0) == 1 ? $user_id : false;
}
示例15: login
function login($email, $password)
{
$user_id = user_id_from_email($email);
$email = sanitize($email);
$password = MD5($password);
return mysql_result(mysql_query("SELECT COUNT(user_id) FROM users WHERE email = '{$email}' AND password = '{$password}'"), 0) == 1 ? $user_id : false;
}