Jump to content

[solved] Echo Out Row Name and Value from SQL Query


deth4uall

Recommended Posts

Okay, I got a slight problem... I have been searching how to show the table info from a SQL Table, and I want it to show me all the row names as well as their values no matter what table I select from which I will put into a HTML Table...

 

SELECT * FROM `UserInfo` WHERE `id` = '1';

$rowz = mysql_fetch_array($result);
echo "<table>";
while (list($key, $value) = each($rowz))
{
  echo "<tr><td>".$key."</td><td>".$value."</td></tr>";
}
echo "</table>";

 

It gives me a good result but has extra stuff I don't need:

 

0   1

id   1

1   deth4uall

name    deth4uall

 

as you can notice it not only gives me the row and value but also an increment for some reason... :S Any suggestions to how to get rid of it?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.