Bman900 Posted May 2, 2009 Share Posted May 2, 2009 I have this code so far: $result = mysql_query("SELECT * FROM question") or die(mysql_error()); $row = mysql_fetch_array( $result ); echo "Name: ".$row['name']; echo " Question: ".$row['question']; echo " Email: ".$row['email']; It only prints the last entry in the database. Quote Link to comment https://forums.phpfreaks.com/topic/156526-get-everything-out-of-the-databse/ Share on other sites More sharing options...
wildteen88 Posted May 2, 2009 Share Posted May 2, 2009 if you are retrieving more than one row from the query you'll need to loop through the results. // loop through the results while($row = mysql_fetch_assoc( $result )) { echo "Name: ".$row['name']; echo " Question: ".$row['question']; echo " Email: ".$row['email']; } Quote Link to comment https://forums.phpfreaks.com/topic/156526-get-everything-out-of-the-databse/#findComment-824199 Share on other sites More sharing options...
Bman900 Posted May 2, 2009 Author Share Posted May 2, 2009 if you are retrieving more than one row from the query you'll need to loop through the results. // loop through the results while($row = mysql_fetch_assoc( $result )) { echo "Name: ".$row['name']; echo " Question: ".$row['question']; echo " Email: ".$row['email']; } My God you are smart! Thank you! Quote Link to comment https://forums.phpfreaks.com/topic/156526-get-everything-out-of-the-databse/#findComment-824201 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.