okay I am working with this now.
what I am seeing is that any information that I want to pull is not coming.

$sql = "SELECT dealer.dealerid as ddealerid, dealer.company as company, dealer.name as 
name,
dealer.surname as surname, dealer.email as email, dealer.contactday as contactday, 
orders.orderid
as oorderid FROM dealer LEFT JOIN orders ON dealer.dealerid = orders.dealerid WHERE 
orders.status
= '10' GROUP BY dealer.dealerid";
$result = mysql_query($sql);
$num_rows = mysql_num_rows($result);
echo "table join select statement -> ".$num_rows."\n";
if (!$result) {
        die('Invalid query: ' . mysql_error());
}
if ($num_rows!='0') {
        //$message ="$num_rows Orders Waiting for the Dealer.\n\n";
                                //$message 
.="----------------------------------------------------------------------\n";
        while($row = mysql_fetch_array($result)) {
                $orderid = $row['orderid'];
                $dealerid = $row['ddealerid'];
                                                                echo "dealer id -> 
".$dealerid." | ";
                                                                $dealerid = 
$row['email'];
                                                                echo "dealer email -> 
".$email."\n";
                                                                /*$message .="\nOrder 
#: $orderid | Dealer ID: $dealerid | ";
                if ($dealerid != NULL && $dealerid != '0') {
                    $sql2 = "SELECT * from dealer WHERE dealerid='".$dealerid."'";
                    $result2 = mysql_query($sql2);
                    if (!$result) {
                        die('Invalid query: ' . mysql_error());
                    }
                    $row2 = mysql_fetch_array($result2);
                    $name = $row2['name'];
                    $email = $row2['email'];
                                                                                
$surname = $row2['surname'];
                                                                                
$company = $row2['company'];
                    $message .="Company: $company | Name: $name $surname | Email: 
$email\n";
                }*/
                                                                //if ($dealerid != '0' 
|| $dealerid != NULL) {
                                                                        $message .= 
"$company (DID: $ddealerid) has $number_orders waiting for them.\n";
                                                                        $message 
.="----------------------------------------------------------------------\n";
                                                                        $message .= 
"Contact.  $name $surname at $email or $contactday \n";
                                                                        $message .= 
"Order #: $oorderid \n";
                                                                        $message
.="----------------------------------------------------------------------\n\n\n";
                                                                //} else {
                                                                        //$message 
.="----------------------------------------------------------------------\n";
                                                                        //$message .= 
"Order #: $orderid has no dealer information.\n";
                                                                        //$message
.="----------------------------------------------------------------------\n\n\n";
                                                                //}
        }
                                $message .="\n\n\n";
                                //$message 
.="----------------------------------------------------------------------\n";
                                $datestamp=date("Y-m-d H:i:s");
                                $message .="Sent on: ".$datestamp."\n";
        $title="$num_rows Orders Waiting for the Dealer";
                                mail($email_address,$title,$message,$headers);
} else {

so I get 

 (DID: ) has  waiting for them.
----------------------------------------------------------------------
Contact.    at  or  
Order #:  
----------------------------------------------------------------------


--- Greg Donald <[EMAIL PROTECTED]> wrote:

> On Mon, 13 Sep 2004 07:14:31 -0700 (PDT), Dan McCullough
> <[EMAIL PROTECTED]> wrote:
> > here is the code.
> > 
> > $sql = "select * from dealer, orders where orders.status='10' and
> > orders.dealerid =
> 
> If you want to associate the orders with the dealer, you probably want
> to do a LEFT JOIN with the relevant field.
> 
> SELECT *
> FROM dealer
> LEFT JOIN orders
>   ON dealer.dealerid = order.dealerid
> WHERE order.status = '10'
> GROUP BY dealer.dealerid
> 
> or something like that.
> 
> 
> -- 
> Greg Donald
> http://destiney.com/
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 


=====
--------------------------------------------------------
"Theres no such thing as a problem unless the servers are on fire!"



        
                
__________________________________
Do you Yahoo!?
New and Improved Yahoo! Mail - 100MB free storage!
http://promotions.yahoo.com/new_mail 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to