dachshund Posted January 31, 2011 Share Posted January 31, 2011 i always get: 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 '://www.webaddress.co.uk/images/shop/uploaded/index/', 'test', 'magazine', 'test' at line 1 $title = $_POST['title']; $index_image = 'http://www.webaddress.co.uk/images/shop/uploaded/index/'.$indexname; $content = mysql_real_escape_string($_POST['content']); $type = mysql_real_escape_string($_POST['type']); $price = mysql_real_escape_string($_POST['price']); $spread1 = 'http://www.webaddress.co.uk/images/shop/uploaded/spreads/'.$image1name; $spread2 = 'http://www.webaddress.co.uk/images/shop/uploaded/spreads/'.$image2name; $spread3 = 'http://www.webaddress.co.uk/images/shop/uploaded/spreads/'.$image3name; $paypal = mysql_real_escape_string($_POST['paypal']); $date = date("Y-m-d H:i:s"); if($title && $content && $type && $price){ $sql = "INSERT INTO `shop` (`title`, `indeximage`, `content`, `type`, `price`, `spread1`, `spread2`, `spread3`, `buyuk`, `live`, `date`) VALUES ('$title', $index_image', '$content', '$type', '$price', '$spread1', '$spread2', '$spread3', '$paypal', '1', '$date')"; $result=mysql_query($sql) or die(mysql_error()); Quote Link to comment https://forums.phpfreaks.com/topic/226271-can-anyone-spot-a-problem-with-this/ Share on other sites More sharing options...
requinix Posted January 31, 2011 Share Posted January 31, 2011 I can spot the problem, but that's probably because I'm looking for it. Look at your SQL. There is something wrong. Quote Link to comment https://forums.phpfreaks.com/topic/226271-can-anyone-spot-a-problem-with-this/#findComment-1168005 Share on other sites More sharing options...
dachshund Posted January 31, 2011 Author Share Posted January 31, 2011 but it's late and i can't see it. any hellppppp? Quote Link to comment https://forums.phpfreaks.com/topic/226271-can-anyone-spot-a-problem-with-this/#findComment-1168007 Share on other sites More sharing options...
ManiacDan Posted January 31, 2011 Share Posted January 31, 2011 Yep, I see it too. It's quote related... Quote Link to comment https://forums.phpfreaks.com/topic/226271-can-anyone-spot-a-problem-with-this/#findComment-1168009 Share on other sites More sharing options...
dachshund Posted January 31, 2011 Author Share Posted January 31, 2011 whaaat? c'mon. isn't this a help forum? Quote Link to comment https://forums.phpfreaks.com/topic/226271-can-anyone-spot-a-problem-with-this/#findComment-1168010 Share on other sites More sharing options...
ManiacDan Posted January 31, 2011 Share Posted January 31, 2011 Yes, but it's not a "do it for you" forum. You're missing a quote in your "VALUES()" section. It should be very easy to spot, since the location is hinted at in your error message and we've told you exactly what to look for. Quote Link to comment https://forums.phpfreaks.com/topic/226271-can-anyone-spot-a-problem-with-this/#findComment-1168017 Share on other sites More sharing options...
dachshund Posted January 31, 2011 Author Share Posted January 31, 2011 11 rows and 11 values - sorry i'm being blind Quote Link to comment https://forums.phpfreaks.com/topic/226271-can-anyone-spot-a-problem-with-this/#findComment-1168020 Share on other sites More sharing options...
dachshund Posted January 31, 2011 Author Share Posted January 31, 2011 i re-wrote the code and it's fixed now, however, i would still appreciate it if one of you could point it out for my peace of mind. i've been staring for ages and can't see it Quote Link to comment https://forums.phpfreaks.com/topic/226271-can-anyone-spot-a-problem-with-this/#findComment-1168028 Share on other sites More sharing options...
cyberRobot Posted January 31, 2011 Share Posted January 31, 2011 Sorry to ruin the fun, but there was a quote missing here: ... VALUES ('$title', $index_image', '$content'... Note that there isn't a quote before $index_image. Quote Link to comment https://forums.phpfreaks.com/topic/226271-can-anyone-spot-a-problem-with-this/#findComment-1168029 Share on other sites More sharing options...
dachshund Posted January 31, 2011 Author Share Posted January 31, 2011 ah yes, thank you Quote Link to comment https://forums.phpfreaks.com/topic/226271-can-anyone-spot-a-problem-with-this/#findComment-1168033 Share on other sites More sharing options...
ManiacDan Posted January 31, 2011 Share Posted January 31, 2011 You're missing a quote in your "VALUES()" section. 11 rows and 11 values - sorry i'm being blind Such responses make me sad. You were told "quote" twice, and you kept counting the values. Quote Link to comment https://forums.phpfreaks.com/topic/226271-can-anyone-spot-a-problem-with-this/#findComment-1168087 Share on other sites More sharing options...
dachshund Posted February 1, 2011 Author Share Posted February 1, 2011 i took it as in: "you're missing a whole quote". not so crazy right? don't get too sad about it… Quote Link to comment https://forums.phpfreaks.com/topic/226271-can-anyone-spot-a-problem-with-this/#findComment-1168295 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.