here is some code that you can look at that may hold the answer for you. It looks like you need to fetch the values once you have comleted the query.
<?php
require("har_globals.php");
require("har_common.php");
$rc = FALSE;
// Connect to the database
if (!($connection=ConnectDB($hostName, $userName, $paswrd, $databaseName))) {
$rc = TRUE;}
// Get photos passed from main selection
if (!$rc) {
$sql = "SELECT photos.*, register.reg_firstname, register.reg_lastname FROM photos LEFT JOIN register ON ph_loginname = reg_loginname WHERE ph_filepath = '" . $id . "' AND ph_photoid > '' order by ph_filepath, ph_shorttitle;";
$sql_result=mysql_query($sql, $connection);}
// Check for system error
if (($rc==FALSE) && ($sql_result==0)) {
$errmsg = "Sorry, an error was encountered. The Webmaster has been notified.";
$message = "000_photothumb: Error selecting from database." . $newline . $sql . $newline;
$message .= sprintf("error:%d %s", mysql_errno($connection), mysql_error($connection));
NotifyWebmaster($message);
$rc = TRUE;}
if (!$rc) {
echo ("<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=5 WIDTH=480><TR>");
$numpics=0;
while ($row = mysql_fetch_array($sql_result)) {
$filepath = "../assets/photos/" . $row["ph_filepath"] . "/" . $row["ph_thumbnail"] . ".jpg" ;
$title = $row["ph_shorttitle"];
$owner = "© " . $row["reg_firstname"] . " " . $row["reg_lastname"];
$filenm = $row["ph_filename"];
$photoid = $row["ph_photoid"];
$numpics++;
echo ("<TD VALIGN=TOP WIDTH=154><P><TABLE WIDTH=154 BORDER=0 CELLSPACING=0 CELLPADDING=0><TR><TD>");
echo ("<A HREF=\"../a1000/000_photolarge.php?filenm=$filenm&photoid=$photoid\"><IMG BORDER=0 SRC=\"$filepath\" ALT=\"$title\"></A>");
echo ("</TD></TR></TABLE>");
echo ("<B><FONT SIZE=-1>$title<BR></FONT></B>");
echo ("<FONT SIZE=-2>$owner</FONT></TD>");
if ($numpics==3) {
echo ("</TR><TR><TD> </TD></TR><TR>");
$numpics=0;
}
}
echo ("</TR></TABLE>");
}
?>