40esp Posted May 29, 2008 Share Posted May 29, 2008 I bet this is a common question, but i cant find the answer. How do I display all records in a database? Can I get a loop example? Link to comment https://forums.phpfreaks.com/topic/107868-solved-mysql/ Share on other sites More sharing options...
.josh Posted May 29, 2008 Share Posted May 29, 2008 $conn = mysql_connect("localhost",'dbname','dbpass'); $db = mysql_select_db("dbname", $conn); $sql = "select * from table"; $result = mysql_query($sql, $conn); while ($list = mysql_fetch_assoc($result)) { foreach ($list as $key => $val) { echo "$key : $val <br />"; } echo "<br />"; } Link to comment https://forums.phpfreaks.com/topic/107868-solved-mysql/#findComment-552933 Share on other sites More sharing options...
40esp Posted May 29, 2008 Author Share Posted May 29, 2008 Thanks =] Link to comment https://forums.phpfreaks.com/topic/107868-solved-mysql/#findComment-552944 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.