Hello list,

I have a database where people can reserve our computer class.
The columns are time_from, time_to, name_id, res_date, confirmed.

I have a table (HTML, not db *g*) that's supposed to print out a=20
month, starting from day 1 to num_days_in_month, and print the
numbers in the right spot as so:

                May, 2002

+-----+-----+-----+-----+-----+-----+-----+
| Mon | Tue | Wed | Thu | Fri | Sat | Sun |
+-----+-----+-----+-----+-----+-----+-----+
|  29 |  30 |  1  |  2  |  3  =A6  4  |  5  |
+-----+-----+-----+-----+-----+-----+-----+
|                ...etc...                |
+-----+-----+-----+-----+-----+-----+-----+

where 29 and 30 will be "grayed out", and if there's a reservation
on, say, Friday, it'll show friday the 3rd bold (and as a link).

I've got a function that returns a $dates array where I've saved the
name of the first day of the month, number of days in month, name of the
month and number of the month. Now I'm confused as to how I would=20
parse the information when printing out the (HTML-)table. What I've
got so far is

for($w=3D1;$w<=3D5;$w++) {  // max. 5 weeks in a month
 echo("<tr>");          // table row
  for($d=3D1;$d<=3D7;$d++) { // days in week
    for($res=3D0;$res<=3D$num_rows;$res++) {   // counter for array from
db

now the problem is, that if I work further on this, I end up with
about four-five for-loops, which doesn't seem to be such a good idea.
The other problem is that I really don't have a clue as to where I'd
smack in a counter for the number of days in the month. However much
I ponder this I can't reach a sensible conclusion. It seems that putting
the loop just about anywhere would be a performance loss ;)

Anyone ever done anything like this?


Cheers,
Markus
-- 
Markus Lervik
Linux-administrator with a kungfoo grip
Vaasa City Library - Regional Library
[EMAIL PROTECTED]
+358-6-325 3589 / +358-40-832 6709


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to