Hey
Any ideas why everytime someone refrshes this page after entering a comment it displays more and more of the same comment, take a look:
http://www.ictkix.com/dlewis/duncan.php
There is also the following error:
INSERT INTO Comment VALUES (NULL,'blahj','blah','blah','blah')
This is the php script:
<?php
echo $sql . "
";
//create sql to query database
//selct all records from table called: Comment
$sql = "SELECT * FROM Comment";
//connect to database using username and password
$dbh=mysql_connect ("localhost", "xxxxxxx", "xxxxxxx");
mysql_select_db ("dcraddoc_dlewis");
//execute sql
$result=mysql_query($sql);
//no. of records found
$num=mysql_numrows($result);
//use loop to show any records found:
$i=0;
while ($i < $num) {
//get data from each record
$id = mysql_result($result,$i,"ID");
$Email = mysql_result($result,$i,"Email");
$When = mysql_result($result,$i,"When");
$Who = mysql_result($result,$i,"Who");
$Comment = mysql_result($result,$i,"Comments");
//display on screen, in a table:
echo "";
echo "$id";
echo "$Email";
echo "$When";
echo "$Who";
echo "$Comment";
echo "";
//increment value of $i to get next record (if any)
$i++;
}
//close database connection
mysql_close();
?>
Any ideas?