view user specific data from mysql in php?

  • Thread starter Thread starter scott m
  • Start date Start date
S

scott m

Guest
this is code that one of my webpages uses to get info from the data base
I want to know what i have to change to get info from the same data base just a different table (table name is users) and a different column (it is bids) please write out the code using the info below... also the code needs to be user specific... so a logged in user views his account balance so to speak!


Code:
// get ending soon auctions
$query = "SELECT ends, id, title FROM " . $DBPrefix . "auctions
         WHERE closed = 0 AND suspended = 0 AND starts <= " . $NOW . "
         ORDER BY ends LIMIT " . $system->SETTINGS['endingsoonnumber'];
$res = mysql_query($query);
$system->check_mysql($res, $query, __LINE__, __FILE__);
$num_auction = mysql_num_rows($res);

$i = 0;
$bgcolor = '#FFFFFF';
while ($i < $num_auction) {
    if ($bgcolor == '#FFFFFF') {
        $bgcolor = '#FFFEEE';
    } else {
        $bgcolor = '#FFFFFF';
    }
    $ends = mysql_result($res, $i, 'ends');
    $difference = $ends - time();
    if ($difference > 0) {
        $ends_string = FormatTimeLeft($difference);
    } else {
        $ends_string = $MSG['911'];
    }
    $template->assign_block_vars('end_soon', array(
            'BGCOLOUR' => $bgcolor,
            'DATE' => $ends_string,
            'ID' => mysql_result($res, $i, 'id'),
            'TITLE' => mysql_result($res, $i, 'title')
            ));
    $i++;
}
$end_soon = ($i > 0) ? true : false;
 
Back
Top