Solved

SQL syntax - IP address datatype

Posted on 2007-04-03
4
879 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 143

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 143

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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
This article discusses how to create an extensible mechanism for linked drop downs.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…

730 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