Jump to content

can anyone spot a problem with this?


dachshund

Recommended Posts

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());

 

Link to comment
https://forums.phpfreaks.com/topic/226271-can-anyone-spot-a-problem-with-this/
Share on other sites

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.