I'm currently making a cart and i'm having trouble with my SQL query below:\[code\]$sql="SELECT * FROM component WHERE componentID IN ("; foreach($_SESSION['cart'] as $id => $value) { $sql.=$id.","; } $sql=substr($sql, 0, -1).")"; $query=mysql_query($sql) or die(mysql_error());\[/code\]So i'm trying to check the SESSION items with my database items using a select and a foreach. The code loops through the SESSION and adds the componentID to the SELECT, which is then taken into the substr function to remove the last comma (e.g. removing '001,002*,*'. I'm sure the syntax is right, however I keep getting a syntax error which is:\[quote\] 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 '00004,00007)' at line 1\[/quote\]Can anyone see what i'm doing wrong here?