TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 04-10-2011, 08:31 PM   #1 (permalink)
The Wanderer
 
Join Date: Jan 2010
Posts: 13
Thanks: 0
pepelepew1962 is on a distinguished road
Default mysql/php loop on date ...

//
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');
//
pepelepew1962 is offline  
Reply With Quote
Old 04-10-2011, 08:41 PM   #2 (permalink)
The Acquainted
 
Join Date: Nov 2009
Location: nr Stratford-Upon-Avon
Posts: 137
Thanks: 3
maeltar is on a distinguished road
Default

could use a bit more info on the tables, can you give a better overview of the schema..
__________________
Thanks... Simon

Sex, Drugs & Linux Rules
Send a message via MSN to maeltar
maeltar is offline  
Reply With Quote
Old 04-11-2011, 12:45 AM   #3 (permalink)
The Wanderer
 
Join Date: Dec 2008
Location: Houston, TX
Posts: 14
Thanks: 1
mjwalsh is on a distinguished road
Default

I don't understand the need for this, can you explain it more? The way you explained it, you could just select all of them from the table and display them by order of the date field, IE:

SELECT * FROM tblTable01 ORDER BY fldName2 ASC

Assuming the dates are in proper formate and the field is set to date or datetime it will work fine and display in the dates order.
Send a message via AIM to mjwalsh Send a message via MSN to mjwalsh
mjwalsh is offline  
Reply With Quote
Old 04-11-2011, 05:14 AM   #4 (permalink)
The Acquainted
 
Join Date: Nov 2009
Location: nr Stratford-Upon-Avon
Posts: 137
Thanks: 3
maeltar is on a distinguished road
Default

If you look close there are 2 tables... thats why I asked form more info...
__________________
Thanks... Simon

Sex, Drugs & Linux Rules
Send a message via MSN to maeltar
maeltar is offline  
Reply With Quote
Old 04-11-2011, 04:57 PM   #5 (permalink)
The Wanderer
 
Join Date: Dec 2008
Location: Houston, TX
Posts: 14
Thanks: 1
mjwalsh is on a distinguished road
Default

I wish the fields and tables were named relevant to what they actually are, it'd be much easier.
Send a message via AIM to mjwalsh Send a message via MSN to mjwalsh
mjwalsh is offline  
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Date/Time Loop ... pepelepew1962 Absolute Beginners 4 04-10-2011 12:08 PM
PHP Access Date problems. mtsang Absolute Beginners 4 06-27-2009 04:59 PM
help me figure out this date thing sarmenhb Absolute Beginners 5 09-15-2008 04:20 PM
Horizontal nested loop problem Dracula General 3 06-05-2008 03:12 PM
Need more ideas for date and time class Wildhoney General 2 01-18-2008 02:22 PM


All times are GMT. The time now is 12:06 PM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design