kumpel Posted June 6, 2012 Share Posted June 6, 2012 Hi I have the following script which seems to come up with an error all the time, I am doing something wrong I just dont know what, cxan someone help? <?phpmysql_connect ("localhost", "xxxx","xxxxx") or die (mysql_error());mysql_select_db ("xxxxxxxxx"); $sql_statement = "SELECT items.quantity". "FROM items LEFT JOIN orders". "ON items.CHECKOUT_ID=orders.CHECKOUT_ID". "ORDER BY orders.ORDER_ID"; $result = mysql_query($sql_statement) or die(mysql_error());while($row = mysql_fetch_array($result)) { echo $row['quantity']. " ". $row['size']; echo "<br />";} ?> Link to comment Share on other sites More sharing options...
birbal Posted June 6, 2012 Share Posted June 6, 2012 showing the error is always helpful to us to help you and locate the problem specificaly."SELECT items.quantity"."FROM items LEFT JOIN orders"when you concatenate it makes string like this"SELECT items.quantityFROM items LEFT JOIN orders"use spaces in between and you dont need to concatenate those. Link to comment Share on other sites More sharing options...
kumpel Posted June 6, 2012 Author Share Posted June 6, 2012 Sorry, here is the error 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 'LEFT JOIN ordersON items.CHECKOUT_ID=orders.CHECKOUT_IDORDER BY orders.ORDER_ID' at line 1 Link to comment Share on other sites More sharing options...
birbal Posted June 6, 2012 Share Posted June 6, 2012 $sql_statement = "SELECT items.quantityFROM items LEFT JOIN ordersON items.CHECKOUT_ID=orders.CHECKOUT_IDORDER BY orders.ORDER_ID"; try this. it should work. Link to comment Share on other sites More sharing options...
yakult Posted June 9, 2012 Share Posted June 9, 2012 ONLY SHOWS AGAIN OTHER CHOICE FROM TABLE!!! Link to comment Share on other sites More sharing options...
yakult Posted June 9, 2012 Share Posted June 9, 2012 THIS WAY! $sql_statement = "SELECT items.quantityFROM items LEFT JOIN ordersON items.CHECKOUT_ID=orders.CHECKOUT_IDORDER BY orders.ORDER_ID"; try this. it should work. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.