Hey everybody :D
I have a problem writing variables to my mySQL database using PHP. I am faerly new to php, and this problem seems to keep irritating me, so please help me hehe !! Thanks :D
When creating a var like:
[code=php]$strSIP = $_SERVER['REMOTE_ADDR'];[/code]
And trying to put it into the mysql_query like:
[code=php]$query = "INSERT INTO `sys_session` (`ID`, `syslog_ip`)" .
" VALUES ('', $strSIP)";
$result = mysql_query( $query );[/code]
I get the mysql_error:
(I have trunk'd some of the code..)
What is wrong here? when i print or echo the $strSIP it gives the perfekt xxx.xxx.x.x IP.. The mySQL database is set up in syslog_ip as varchar(128)..
Thanks for any reply.
I have a problem writing variables to my mySQL database using PHP. I am faerly new to php, and this problem seems to keep irritating me, so please help me hehe !! Thanks :D
When creating a var like:
[code=php]$strSIP = $_SERVER['REMOTE_ADDR'];[/code]
And trying to put it into the mysql_query like:
[code=php]$query = "INSERT INTO `sys_session` (`ID`, `syslog_ip`)" .
" VALUES ('', $strSIP)";
$result = mysql_query( $query );[/code]
I get the mysql_error:
You have an error in your SQL syntax near '.1.2)' at line 1
What is wrong here? when i print or echo the $strSIP it gives the perfekt xxx.xxx.x.x IP.. The mySQL database is set up in syslog_ip as varchar(128)..
Thanks for any reply.
Comment