<?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>";
?>

Try that, you tried to call $mysql_query, when you needed to call
mysql_query.  In your code, $mysql_query isn't a variable, it's a function
in PHP.
-----Original Message-----
From: Deependra B. Tandukar [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, March 07, 2001 9:34 PM
To: [EMAIL PROTECTED]
Subject: [PHP] mysql_fetch_array()


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






--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to