order by

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
PHP Nubsauce
Forum Newbie
Posts: 2
Joined: Sat Jun 07, 2008 10:22 pm

order by

Post 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
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Re: order by

Post 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.
Post Reply