Jump to content

Database not updating


Jon12345

Recommended Posts

I have the following code to add a record into my mysql database:

[code]<?php
$kid="abc";
$ipaddress="12342";
$sid="7Search";
$time = date("H:i:s");
$date = date("m.d.y");

$db=mysql_connect("localhost","user","pw");
mysql_select_db("pmm__log",$db);
$query="INSERT INTO visitor_log (ipaddress,date,time,kid,sid) VALUES ('$ipaddress','$date','$time','$kid','$sid')";
mysql_query($query) or die('Database Query Error: '.mysql_error());

mysql_close() 
?> [/code]

But it doesn't update. I cannot work out why. I get the following error message echoed to the browser:

Database Query Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''ipaddress','date','time','kid','sid') VALUES ('12342','12.11.06

Any ideas what the problem might be? Permissions? Syntax?

Thanks,

Jon
Link to comment
https://forums.phpfreaks.com/topic/30277-database-not-updating/
Share on other sites

Archived

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

×
×
  • Create New...

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.