//
Hello, I am in great need for a loop on a group of records. Basically I need a loop on the date field and pull all those records for that date, then loop onto the next date in the table. If I had 3 records for 04/03/2011, dispaly them, then grab the next date, say 04/06/2011 and display all of those records. It is probably very simple, but not simple enough for me, can anyone help with this please.
//
//
tblTable02.fldName2 // Date Field
//
//
$result = mysql_query('SELECT tblTable01.fldName1, tblTable01.fldName2, tblTable01.fldName3, tblTable02.fldName1, tblTable02.fldName2 FROM tblTable01, tblTable02 WHERE (tblTable01.fldName1 = tblTable02.fldName1) ORDER BY tblTable01.fldName1, tblTable02.fldName2');
//
mysql/php loop by date ...
Moderator: General Moderators
-
pepe_lepew1962
- Forum Commoner
- Posts: 44
- Joined: Thu Nov 20, 2008 10:29 am
Re: mysql/php loop by date ...
Why don't you just change your sorting order to
This way it will arrange everything by date and then you can just keep looping. if you want to start with specific date then add it to the WHERE clause
Code: Select all
ORDER BY tblTable02.fldName2, tblTable01.fldName1;