Help - Search - Members - Calendar
Full Version: Won't Write To My Mysql Datbase
Zymic Webmaster Forums > Zymic Free Web Hosting > Databases & MySQL
swordz
Hi.

I've installed xampp so that I can test my pages on my comp, and am trying to get to grips with MySQL. I've created the database, and a table within the database, but it just won't write to it. Here's the code:

CODE
else {
$DBhost = "localhost";
$DBuser = "robertsworder_ro";
$DBpass = "mypassword";
$DBName = "robertsworder_gu";
$table = "guestbook";

if (mysql_connect($DBhost, $DBuser, $DBpass) === FALSE) {
$file = "failbook.html";
}
else {
$db = mysql_connect($DBhost, $DBuser, $DBpass);
mysql_select_db($DBName, $db);

$sqlquery = "INSERT INTO $table VALUES ('date('d/m/y')','$name','$comments','0')";
mysql_query($sqlquery);

mysql_close();

$file = "guestbook.html";
}


Obviously there is more code above, but it's not related to MySQL at all, and I've tested it previously (This data used to go to a .txt file!).

What makes this more confusing is that I am getting the guestbook.html code (I have an include further down), so it's going through the correct path, just not writing to the database.

Hope someone can help,

swordz
swordz
I've got this now, so don't worry about it...

swordz
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.