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? 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 />"; } } 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 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
Archived
This topic is now archived and is closed to further replies.