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. 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']; } 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! 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
Archived
This topic is now archived and is closed to further replies.