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? Quote 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 />"; } Quote 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 =] Quote Link to comment https://forums.phpfreaks.com/topic/107868-solved-mysql/#findComment-552944 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.