|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
INSERT INTO....
I'm trying my hand at SQL (with PHP)and trying to create a general visitor log.
When I use this code: $sql = "INSERT INTO $table_name (ip, date, page_url) VALUES ($ip, $datestamp, $page)"; I end up with this 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 'crestononline.com/sitelog.php)' at line 1 For some reason it wont let me post anything other than letters and numbers. I have the page_url field in my database set up to varchar(255). What could be causing this problem? |
|
#2
|
|||
|
|||
|
RE: INSERT INTO....
you need to put variables in quotes, like so:
Code:
$sql = "INSERT INTO $table_name (ip, date, page_url) VALUES ('$ip', '$datestamp', '$page')";
|
![]() |
| Viewing: Codewalkers Forums > Other Technologies > Database Help > INSERT INTO.... |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|