The following page searches a table for missing info. Once it finds a record with info I need it will then display it in a list.
example:
hey bob, you are missing
stain number
border color
on joes cafe
hey mike, you are missing
blah blah
on truckstop cafe
The problem I'm having is it displays each distrubuter and restaurant even if all information is present.
example:
hey todd, you are missing
on waffle house
Anyone know how to fix this?
<?php
error_reporting(E_ALL);
include('include/db_con.php');
/*If (date("d") != 1 || date("d")!=15){ exit; }*/
$query="SELECT dist_id, table_type, stain, paint, qty_oak, qty_nooak, contact_fname, rest_name, rest_address_1, rest_phone_sf, corners, stain, bg_colors, bg_img, bd_colors FROM DATABASE WHERE (order_year > '2006' || order_date > '05/01/2007') & (table_type = '' || qty_oak = '0' & qty_nooak = '0' || contact_fname = '' || rest_address_1 = '' || rest_phone_sf = '0' || corners = '' || stain = '' || paint = '')";
$result=mysql_query($query);
while($row = mysql_fetch_assoc($result)){
$dist_id = $row['dist_id'];
$table_type = $row['table_type'];
$stain = $row['stain'];
$paint = $row['paint'];
$qty_oak = $row['qty_oak'];
$qty_nooak = $row['qty_nooak'];
$contact_fname = $row['contact_fname'];
$rest_name = $row['rest_name'];
$rest_address = $row['rest_address_1'];
$rest_phone_sf = $row['rest_phone_sf'];
$corners = $row['corners'];
$stain = $row['stain'];
$paint = $row['paint'];
$bg_colors = $row['bg_colors'];
$bg_img = $row['bg_img'];
$bd_colors = $row['bd_colors'];
$query2="SELECT email, fname FROM sales_rep WHERE sales_id=$dist_id";
$result2=mysql_query($query2);
while($row2 = mysql_fetch_assoc($result2)){
$email = $row2['email'];
$fname = $row2['fname'];
echo "$fname, you are missing:<br>";
if ($table_type == "") {
echo "type of table<br>";
}
if ($qty_oak != "0" & $stain == "") {
echo "stain number<br>";
}
if ($qty_nooak != "0" & $paint == "") {
echo "paint number<br>";
}
if ($contact_fname == "") {
echo "restaurant contact<br>";
}
if ($rest_address == "") {
echo "restaurant address<br>";
}
if ($rest_phone_sf == "0") {
echo "restaurant phone number<br>";
}
if ($corners == "") {
echo "size of corners<br>";
}
if ($bg_colors == "") {
echo "background colors<br>";
}
if ($bg_img == "") {
echo "background image<br>";
}
if ($bd_colors == "") {
echo "border color<br>";
}
echo "for $rest_name <br><br>";}}
?>