deth4uall Posted December 5, 2007 Share Posted December 5, 2007 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 https://forums.phpfreaks.com/topic/80221-solved-echo-out-row-name-and-value-from-sql-query/ Share on other sites More sharing options...
trmbne2000 Posted December 5, 2007 Share Posted December 5, 2007 $rowz = mysql_fetch_assoc($result); Should work for you. Link to comment https://forums.phpfreaks.com/topic/80221-solved-echo-out-row-name-and-value-from-sql-query/#findComment-406625 Share on other sites More sharing options...
deth4uall Posted December 5, 2007 Author Share Posted December 5, 2007 thanks! I should have thought of that! Link to comment https://forums.phpfreaks.com/topic/80221-solved-echo-out-row-name-and-value-from-sql-query/#findComment-406629 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.