Page 1 of 1

order by

Posted: Fri Jul 11, 2008 5:22 pm
by PHP Nubsauce
Hey all, see if you can figure this one out..

Code: Select all

$links33 = @mysql_query("SELECT * FROM ".$mysql_pretext."_customer_payments WHERE customer_id = '$customerid' ORDER BY date ASC");
I'm trying to display all customer payments from oldest to newest, and its doing that, but its breaking it up by customer!

Example:

1-1-08 customer a
2-2-08 customer a
3-3-08 customer a
1-2-08 customer b
2-3-08 customer b
3-4-08 customer b

Any help making it look like so:

1-1-08 customer a
1-2-08 customer b
2-2-08 customer a
2-3-08 customer b
3-3-08 customer a
3-4-08 customer b


Please?

Nubsauce

Re: order by

Posted: Fri Jul 11, 2008 6:43 pm
by Benjamin
You've got that query in a loop pulling 1 customer at a time I bet. That would be your problem. Maybe take all the results and then sort the array by the date field.