PHP with mysql
| From: | Matt Greene | Date: | Thu, 09 Dec 1999 23:15:30 +0000 |
| Subject: | PHP with mysql | ||
| Groups: | php.version4 | ||
| Request: | Send a blank email to php-version4+get-7742@lists.php.net to get a copy of this message | ||
What is the command that I would use to display a row from a mysql table?
Here is what I am using now:
// -----------------------------------------------Start
function show() {
global $mysqlconn, $sqluserdb, $sqlmaindb, $sqldb, $PHP_SELF, $id;
$query = "SELECT * FROM $sqlmaindb";
$result = mysql_db_query( "$sqldb", $query, $mysqlconn);
if ($result) {
mysql_data_seek( $result, $id );
$row=mysql_fetch_array($result);
$name = $row["name"];
$email = $row["email"];
$topic = $row["topic"];
$body = $row["body"];
echo "<table border='1' width='100%' bgcolor='#003973'
cellspacing='1'
bordercolor='#000000'>";
echo "<tr><td><font size=1 color=white><b>$topic</b> -
";
echo "Posted by $name | ";
echo "<a href='mailto:$email'>$email</a></td></tr>";
echo "<tr><td>$body</td></tr></table>";
} else {
echo "No data.";
}
}
// -----------------------------------------------End
all of the variables are defined that are in global, currently this will
show only the first row and nothing else, the $id is what it is getting the
number of the row from but it only displays the first in the table and
nothing else.
Please help...