August 13, 201313 yr iv just cant see what is rong function get_images_by_ref($items) { $query = "SELECT * FROM store WHERE id= $items"; $image_set = mysql_query($query); confirm_query($image_set); return $image_set; } Please help it is doing my head my Database query failed: You have an error in your SQL syntax; check themanual that corresponds to your MySQL server version for the rightsyntax to use near '' at line 3 Thanks Pump
August 14, 201313 yr It's mostly likely that $items is coming through as a string - wrap it in a single quotes: WHERE id = '$items' and see what happens.
August 15, 201313 yr Thanks Chris that got in sorted ur ace or as a more appropriate fixed do a tad bit of typecasting and convert it to an integer function get_images_by_ref($items) { //Be sure $items comes across as an integer $items = (int) $items; //End string to int conversion $query = "SELECT * FROM store WHERE id= $items"; $image_set = mysql_query($query); confirm_query($image_set); return $image_set; } here is abit more info about typecasting in php http://www.electrictoolbox.com/type-casting-php/
Create an account or sign in to comment