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?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.