manwhoeatsrats Posted January 22, 2010 Share Posted January 22, 2010 Okay maybe I have gone blind, but I don't see where the error is in my query. any help would be appreciated. both fields that are to be injected into are varchar(55) here is a shortened version of my script <?php $users_ip = $_SERVER['REMOTE_ADDR']; mysql_query("INSERT INTO ip_ban SET (ip_address ,ban_reason) VALUES ('$users_ip','1')") or die("psau_error5 " . mysql_error()); ?> As you can see, the values are making it to the query, and I am not getting any errors about the field names.....I am just at a loss... The error: psau_error5 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 '( ip_address , ban_reason ) VALUES ('127.0.0.1' , '1' )' at line 1 Quote Link to comment https://forums.phpfreaks.com/topic/189431-mysql-injection-problem/ Share on other sites More sharing options...
kickstart Posted January 22, 2010 Share Posted January 22, 2010 Hi "SET" isn't needed there. All the best Keith Quote Link to comment https://forums.phpfreaks.com/topic/189431-mysql-injection-problem/#findComment-999903 Share on other sites More sharing options...
manwhoeatsrats Posted January 22, 2010 Author Share Posted January 22, 2010 Oh you have got to be joking me! yes that was it, I can't believe I made that mistake. Thanks a lot for your help! lol Quote Link to comment https://forums.phpfreaks.com/topic/189431-mysql-injection-problem/#findComment-999908 Share on other sites More sharing options...
kickstart Posted January 22, 2010 Share Posted January 22, 2010 Hi Don't worry, easy to do. Spend ages looking at something you yourself have written and not spot it, while a fresh pair of eyes spots it rapidly. All the best Keith Quote Link to comment https://forums.phpfreaks.com/topic/189431-mysql-injection-problem/#findComment-999911 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.