> Any1 knows how to query the database to only
> list orders that has order status 1 as its last status.
$query = "SELECT Invoice, Status, Created FROM invoice_status ";
$query .= "ORDER BY Created";
$records = mysql_query($query, $DatabaseLink);
/* Do normal error checking. */
if (mysql_num_rows($records))
{
$prevObj = 0;
while ($obj = mysql_fetch_object($records))
{
if (!is_int($prevObj) && $obj->ID!=$prevObj->ID)
{
/*
** We have finished all of the status records for a given
invoice.
** $prevObj ought to be set to the "last status" of a
specific
** invoice.
*/
if ($obj->Status == 1)
{
$desiredInvoices[] = $obj->Invoice;
}
}
$prevObj = $obj;
}
}
/* The while loop can't handle the last status message without
additional work */
if ($obj->Status == 1)
{
$desiredInvoices[] = $obj->Invoice;
}
I think something along those lines will work.
-jj
--
if (shannon - jj) * behrens == webEngineer["CLEAR INK�"]:
print "<i>imagination is the only real medium(sm)</i><br>"
------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
Site: http://www.working-dogs.com/freetrade/
Problems?: [EMAIL PROTECTED]