Novice help with multi table database

Hi I hope someone can help, the code below checks for the sections I need, but I want it to exclude if the warehouse_id is deleted ( this is in another table ‘damage_warehouses’ ‘deleted’=1 )

[php]//fetch the array of outstanding jobs
$sql = mysql_query(“SELECT id, warehouse_id, section, inspection_due, inspector, email FROM damage_warehouse_inspectionsections WHERE inspection_complete=‘0’”);
while($result = mysql_fetch_array($sql))
[/php]

Many thanks in advance

When you say warehouse_id is deleted, do you mean that particular field is empty? Also integers don’t get ’ symbols round them (assuming inspection_complete is an integer)
[php]
$sql = mysql_query(“SELECT id, warehouse_id, section, inspection_due, inspector, email FROM damage_warehouse_inspectionsections WHERE inspection_complete=0 AND warehouse_id>0”);
[/php]

If you mean check a different table, i’m unsure howto do that without a load of loops

Sponsor our Newsletter | Privacy Policy | Terms of Service