Solved

SQL syntax - IP address datatype

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
How to validate 2 forms at once 8 27
Wordpress update causing pages to crash 1 21
PHP json decode 9 26
php ssh2_scp_send 1 6
Both Easy and Powerful How easy is PHP? http://lmgtfy.com?q=how+easy+is+php (http://lmgtfy.com?q=how+easy+is+php)  Very easy.  It has been described as "a programming language even my grandmother can use." How powerful is PHP?  http://en.wikiped…
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…
The viewer will learn how to dynamically set the form action using jQuery.
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.

746 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now