MySql_fetch_row loop (newbie alert)
| From: | Ryan A | Date: | Sat, 26 Apr 2003 19:43:35 +0000 |
| Subject: | MySql_fetch_row loop (newbie alert) | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-145374@lists.php.net to get a copy of this message | ||
Hi ppl,
Ok, first let me explain what i am trying to do:
1)Select all the rows from the database
2)At the end of the row I want to have a link to "delete.php" thats which
contains the CNO
eg:
<a href="delete.php?cno=$cno>
3)Same for modify etc
After reading the book and screwing around with the code I have come so far
(scroll down for the code)
<?php
$database["sql"] = " select * from ryan1 order by cno" ;
if($result= mysql_query($database["sql"]))
{
while($row = mysql_fetch_row($result))
{
print("<br>CNO:" . $row[0] . "<br>NAme: " . $row[1] .
"<br>");
}
}
else
{print("Query error: " . mysql_errno() . ", " . mysql_error() . "using SQL
"
. $database["sql"]);}
?>
I know this must be pretty simple but being a newbie have gotten stuck.
Thanks in advance.
Cheers,
-Ryan