Re: multiple table rows into an array, and creating a calendar
| From: | David T-G | Date: | Thu, 13 Nov 2003 20:36:39 +0000 |
| Subject: | Re: multiple table rows into an array, and creating a calendar | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-169567@lists.php.net to get a copy of this message | ||
Dave --
..and then Dave G said...
%
..
% My problem is that I can't figure out how to compare the results
% of the query to the dates on the calendar so that they display on the
% right dates.
OK.
% I thought I should put those date in an array and then on each
% date, search that array for a matching date, and if it's found, then
Generally when working with a database you want to avoid sucking in the
entire result set and working on it, since it could be huge. It's much
better to walk down it one row at a time -- and hence mysql_fetch_array()
and friends.
What I'd do in your situation is do my select based on whatever criteria
you might use and also be sure to order by the date and then just loop
through your calendar. Pull an initial row and then start a loop which
- picks a calendar date
- checks to see if it matches the row
- if it does, print it and pull the next one and repeat
- if not, close the day and repeat
through your entire $display_period.
HTH & HAND
:-D
--
David T-G * There is too much animal courage in
(play) davidtg@justpickone.org * society and not sufficient moral courage.
(work) davidtgwork@justpickone.org -- Mary Baker Eddy, "Science and Health"
http://justpickone.org/davidtg/ Shpx gur
Pbzzhavpngvbaf Qrprapl Npg!