Forum Moderators: coopster
$insert = mysql_query("insert into $table values ('$week', '$date', '$time', '$ip', '$host', '$browser', '$referrer', '$query')", $dbh)
or die("Could not insert data because ".mysql_error());
The $table is 06 and I get this error message:
Could not insert data because 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 '06 values ('23', '2005-06-07', '8:24:49', 'xx.#*$!.xxx.xx', ''
So what have I done wrong here?
Here's an example of an easy way to flush out SQL errors in your code:
$query = "insert into $table values ('$week', '$date', '$time', '$ip', '$host', '$browser', '$referrer', '$query')";echo $query; # Comment out this line once it works
$insert = mysql_query($query, $dbh)
or die("Could not insert data because ".mysql_error());
insert into 06 values ('23', '2005-06-07', '9:31:27', 'xx.#*$!.xxx.xx', '', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.8) Gecko/20050511 Firefox/1.0.4', '', '')Could not insert data because 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 '06 values ('23', '2005-06-07', '9:31:27', 'xx.xxx.xxx.xx', '',