Originally posted by madwormer2
<?php
$result=mysql_query("select * from gen where id = ".$_POST['id'] );
if (mysql_num_rows($result) == 0) {
print "SORRY"; }
else
{
print "<table border='0' cellspacing='1' cellpadding='1'>\n";
while ($get_info = mysql_fetch_row($result))
{
echo "<tr><td> Name:</td><td> " . $get_info->name . "</td></tr>\n";
echo "<tr><td> Address:</td><td> " . $get_info->address . "</td></tr>\n";
echo "<tr><td> Tel. no.:</td><td> " . $get_info->tel . "</td></tr>";
}
echo "</table>";
}
?>
Correct me if I'm wrong, but mysql_fetch_row() returns an array, not an object.
http://www.php.net/manual/en/function.mysql-fetch-row.php
So using a "->" operator won't work, as you're not accessing object values, you're accessing array elements, so you'd use "[]" instead, using integers as array indices (0 based, of course).
Using mysql_fetch_array, however, allows you to access the array values using the table column names defined in MySQL, which is a lot cleaner from a coding point of view. So wempy's suggestion should work by all means. Have you made sure you are using the correct table column names (the same ones your MySQL table has)?
Then again, I'm just a n00b. I could be completely wrong.
James