hi there,
I’ve just followed a tutorial to create a PHP/MySQL guestbook which seemed to be working but it seems the entries aren’t being added to the database as I check the contents of the table in phpmyadmin, each is empty apart from the id and date/time fields.
you can view the guestbook here : http://www.predator-uk.net/naa/index.php?p=guestbook
I was assuming it would be the script used to add the data to the database that is the problem but I can’t seem to find whats wrong. This is the script used to process the form data :
mysql_connect("$host", "$username", "$password")or die("cannot connect server ");
mysql_select_db("$db_name")or die("cannot select DB");
$datetime=date("y-m-d h:i:s");
$sql="INSERT INTO $tbl_name(name, email, comment, datetime) VALUES
('$name', '$email', '$comment', '$datetime')";
$result=mysql_query($sql);
if($result){
echo "Successful";
echo "<BR>";
echo "<a href='index.php?p=viewguestbook'>View guestbook</a>";
}
else {
echo "ERROR";
}
mysql_close();
Hope someone can help,
Cheers,
Jeff :hr: