mysql_fetch_array()
| From: | Deependra B. Tandukar | Date: | Thu, 08 Mar 2001 03:33:32 +0000 |
| Subject: | mysql_fetch_array() | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-42988@lists.php.net to get a copy of this message | ||
Greetings!
I am using PHP and MySQL in RedHat 6.0.
I have used mysql_fetch_array() to display the datas in web page but all the
columns are printed twice. What can be the wrong with my code:
<?php
$connection=mysql_connection(...............);
$db=mysql_select_db(.....................);
$sql="select * from my db";
$sql_result=$mysql_query($sql,$connection);
print "<table>";
while ($row=mysql_fetch_array($sql_result))
{
print "<tr>";
foreach ($row as $field)
print "<td>$field</td>";
print "<td><a href=\"search.php?ID=$row[ID]\">";
print "Get it";
print "</a></td>";
print "</tr>";
}
print "</table>";
?>
But it works fine with mysql_fetch_row() however it does not pass the pass
the variable ID.
Looking forward to hearing from you.
Warm regards,
DT