Perad Posted October 22, 2007 Share Posted October 22, 2007 Take this example. $sql = "DESCRIBE users"; $result = mysql_query($sql); $row = mysql_fetch_assoc($result); foreach ($row as $key => $val) { print $key . " - ". $val. "<br />"; } This only prints out the first field in the table. How do I use php to print them all? Quote Link to comment https://forums.phpfreaks.com/topic/74315-solved-print-out-mysql-describe/ Share on other sites More sharing options...
only one Posted October 22, 2007 Share Posted October 22, 2007 while($row = mysql_fetch_assoc($result)){ foreach ($row as $key => $val) { print $key . " - ". $val. "<br />"; } } Quote Link to comment https://forums.phpfreaks.com/topic/74315-solved-print-out-mysql-describe/#findComment-375465 Share on other sites More sharing options...
Perad Posted October 22, 2007 Author Share Posted October 22, 2007 of course, duh Quote Link to comment https://forums.phpfreaks.com/topic/74315-solved-print-out-mysql-describe/#findComment-375471 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.