I have a php page that uses a variable passed by url to display information from a table. I have been using a very simple code for that:
Code: Select all
$id=$_GET['id'];
$query="SELECT * FROM lineitm WHERE SO_NO=$id";Table 1 lineitm:
SO_NO
SHIP_ID
other fields
Table 2 custshp:
SHIP_ID
other fields
I have tried to use JOIN and I can list table 1 and the corresponding ship_id in table 2 but it doesn't limit table one to so_no. Here is the code I am trying to edit to limit table 1 to so_no:
Code: Select all
$query = "SELECT lineitm.QTY,lineitm.DESCRIP, custshp.CITY ".
"FROM lineitm LEFT JOIN custshp ".
"ON lineitm.SHIP_ID = custshp.SHIP_ID";Thanks for the advice.