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))
Ah, I see what you’re trying to do. Let me see if I understand though before I start assuming… you’re asking the query to return all the sections -except- for the rows that don’t exist, correct?
If this is the case (please, feel free to correct me if I’m wrong), then you don’t need to do that, the rows won’t even be there.
If this is -not- the case, and you’re looking for a certain value for that particular row, then I might know the problem there, too. Your query is fine, but there’s some touching up to be done Example:
while($res = mysql_fetch_assoc($sql)){
echo $res[“id”];
}
And so on and so forth for the different fields that you want to print out. I hope this helped, please don’t hesitate to ask me for further assistance, I can accept being wrong.
if you are grabbing data from one table and using that to process data from a second table you need to use join in your query. See the mysql manual for join to see how to structure your query.