Solved

SQL syntax - IP address datatype

Posted on 2007-04-03
4
877 Views
Last Modified: 2011-10-03
Hi experts,

I keep getting this error while trying to test a php form that insert data into (myisam) mysql database:
"Error entry: 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 '.29.230' at line 9"

This line refers to IP address.  I set the IP data-type to VARCHAR(15). So I am not really sure what's the problem?
0
Comment
Question by:Refael
  • 2
  • 2
4 Comments
 
LVL 142

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 500 total points
ID: 18845222
did you put single quotes around the value of the IP address?
0
 

Author Comment

by:Refael
ID: 18845258
Hi,
The IP is an auto insertion

In the form : <input type="hidden" name="IP" value="<?php echo $_SERVER['REMOTE_ADDR'] ?>" />

And $ip = stripslashes($ip);
0
 
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 18845269
that is not the place where there is the problem.
please show the code that builds up the sql statement
0
 

Author Comment

by:Refael
ID: 18845289
you were right!

the problem was here : IP= $IP";

should have been : IP= '$IP' ";

thanks!
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses four methods for overlaying images in a container on a web page
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
The viewer will learn how to count occurrences of each item in an array.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question