chilllax Posted June 5, 2006 Share Posted June 5, 2006 I am trying to learn php (if you have any tips for better learning please post) and I created a form to submit info into the database and that worked. Now I want to display the contents of the database using this script:[code]<html><title>Success, what a word.</title><head><h2>The contents of the database are as follows</h2></head><body><?php$con = mysql_connect("localhost","chilllax_chillla","mypassword");if (!$con) { die('Could not connect: ' . mysql_error()); }mysql_select_db("chilllax_tournament", $con);$sql = 'SELECT * FROM `survey` LIMIT 0, 30 ';?></body></html>[/code]The problem is that only the header appears and nothing else. any help is greatly appriciated. [img src=\"style_emoticons/[#EMO_DIR#]/smile.gif\" style=\"vertical-align:middle\" emoid=\":smile:\" border=\"0\" alt=\"smile.gif\" /] Quote Link to comment https://forums.phpfreaks.com/topic/11283-show-database-contents/ Share on other sites More sharing options...
poirot Posted June 5, 2006 Share Posted June 5, 2006 [code]while ($row = mysql_fetch_row(mysql_query($sql))) { print_r($row);}[/code] Quote Link to comment https://forums.phpfreaks.com/topic/11283-show-database-contents/#findComment-42229 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.