PHP / MySQL - Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING?

Aluaine

New member
$sql = "SELECT * FROM images WHERE Image_ID='".$_GET['id']"'";

can anyone see why i'm getting that error from the line of code above?

Thanks
 
$sql = "SELECT * FROM images WHERE Image_ID = ".$_GET['id'];

I think that will work. I normally use less quotation marks for simpler reading. Adding them is sometimes not always required, so I try and stick with the fewest number possible.

Oh yeah, you're missing the concatenation mark too, I didn't realize I had added it.
 
Back
Top