Jump to content


Photo

Show database contents


  • Please log in to reply
1 reply to this topic

#1 chilllax

chilllax
  • New Members
  • Pip
  • Newbie
  • 4 posts

Posted 05 June 2006 - 11:38 PM

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:
<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>

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\" /]

#2 poirot

poirot
  • Members
  • PipPipPip
  • Advanced Member
  • 646 posts
  • LocationAustin, TX

Posted 05 June 2006 - 11:43 PM

while ($row = mysql_fetch_row(mysql_query($sql))) {
   print_r($row);
}

~ D Kuang




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users