It only outputs the first tech.  It worked fine until I tried to add the end date ino 
it.

Thanks for all teh help!

// Get technician info
$TECH_SQL = "SELECT * FROM employees";
$TECH = MYSQL_QUERY( $TECH_SQL, $CONNECTION) OR DIE ( mysql_error() );

while ( $row = mysql_fetch_array( $TECH ) )
{
        $tech_id = $row["id"];
        $tech_name_last = $row["name_last"];
        $tech_name_first = $row["name_first"];

        $tech_initials_first = substr( $tech_name_first, 0, 1 );
        $tech_initials_last = substr( $tech_name_last, 0, 1);
        $tech_initials = "$tech_initials_first$tech_initials_last";

        $tech_name = "$tech_name_first $tech_name_last";

        echo "                  <table width=\"100%\">\n";
        echo "                  <p align=\"center\" class=\"big\">$tech_name</p>\n";

        // Reset counters for this tech
        $tech_hour = 0;
        $tech_cost = 0;


        // Start pulling ticket work
        $TICKET_WORK_SQL = "SELECT * FROM tickets_work
                WHERE employee_id = '$tech_id'
                AND start > '$start'
                AND end < '$end'
                ORDER BY start";
        $TICKET_WORK_INFO = MYSQL_QUERY( $TICKET_WORK_SQL, $CONNECTION ) OR DIE ( 
mysql_error() );

        while ( $row = mysql_fetch_array( $TICKET_WORK_INFO ) )
        {
                $ticket_id = $row["ticket_id"];
                $start = $row["start"];
                $end = $row["end"];
                $total_hours = $row["total_hours"];
                $total_billable = $row["total_billable"];

-----Original Message-----
From: Miles Thompson [mailto:[EMAIL PROTECTED]]
Sent: Thursday, August 15, 2002 2:26 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] SELECT statement problem


SELECT * FROM tickets_work
WHERE employee_id = '$tech_id' AND
         start > '$start' AND
         end < '$end'
ORDER BY start

Which will select everything from tickets_work for a given employee between 
start and end. What is not working?

Miles Thompson

At 02:15 PM 8/15/2002 -0400, Evan S. Weiner wrote:
>Hello all,
>
>I have this SQL statement I am trying to use and no matter what 
>combination I use, I cannot get it to work.  The start and end if clauses 
>need to be grouped together.
>
>SELECT * FROM tickets_work WHERE employee_id = '$tech_id' && ( start > 
>'$start' && end < '$end' ) ORDER BY start
>
>Anyone able to help me?
>
>Thanks!
>
>Evan
>
>
>--
>PHP Database Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php



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


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

Reply via email to