Author Topic: Novice help with multi table database  (Read 178 times)

acesites

  • New Member
  • *
  • Posts: 2
  • Karma: 0
    • View Profile
Novice help with multi table database
« on: June 18, 2012, 04:58:59 PM »
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 Code: [Select]
//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))


Many thanks in advance

RaythXC

  • PHP Programmer & Web-Designer
  • Expert PHP Helper
  • Senior Member
  • *****
  • Posts: 395
  • Karma: 10
  • Freelance PHP Programmer/Web-Designer
    • View Profile
    • Rayth.Info
Re: Novice help with multi table database
« Reply #1 on: June 18, 2012, 07:55:39 PM »
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 Code: [Select]

$sql 
mysql_query("SELECT id, warehouse_id, section, inspection_due, inspector, email FROM damage_warehouse_inspectionsections WHERE inspection_complete=0 AND warehouse_id>0");


If you mean check a different table, i'm unsure howto do that without a load of loops
RaythXC - My Home Site
Note: most answers I give come from the php manual located at PHP.Net