Jump to content

Archived

This topic is now archived and is closed to further replies.

chilllax

Show database contents

Recommended Posts

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

Share this post


Link to post
Share on other sites
[code]while ($row = mysql_fetch_row(mysql_query($sql))) {
   print_r($row);
}[/code]

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.