fetching columns

wxdqz

New Member
mysql_fetch_array() is doing every thing its suppose to do. its fetching one row of data and returning the first element in $row[0], the second element in $row[1] and so forth. now to fetch the next row of data, call mysql_fetch_array() again.


mysql_pconnect("localhost","username","password") or die("Unable to connect with MySQL. Reason: ".mysql_error());

$result = mysql_db_query("db","SELECT name FROM table") or die ("Unable to execute MySQL query. Reason: ".mysql_error());

echo "<TABLE BORDER=1><TR><TH>Table Name</TH></TR>";

while($row = mysql_fetch_array($result))
{
echo "<TR><TD>",$row[0],"</TD></TR>";
}
echo "</TABLE>";
 
Back
Top