Forum Moderators: coopster

Message Too Old, No Replies

Creating a Calander table from DB

and printing it

         

Sarah Atkinson

2:55 pm on May 17, 2005 (gmt 0)

10+ Year Member



I have a db with dates and menus for those dates. I want to put the data into a table with 5 columns (Monday-Friday). I can get them into a list. How do I get them formatted into a table so that the correct day is in the right column and such? Can I do it all in one quarry or will I have to do a quarry for each day or each week?

Also I want to print this table out. Is there a print page function in PHP?

Sarah

Sarah Atkinson

4:53 pm on May 17, 2005 (gmt 0)

10+ Year Member



There wouldn't be a print function in php because it is server side and a client side script would be needed to print.

I knew that--realy.

webkami

4:00 pm on May 18, 2005 (gmt 0)

10+ Year Member



<a href='javascript:parent.print()'>Print Page</a>

:) enjoy!

Sarah Atkinson

9:23 pm on May 18, 2005 (gmt 0)

10+ Year Member



now if only i can figure out how to format the stupid thing

webkami

8:16 am on May 19, 2005 (gmt 0)

10+ Year Member



now be specific to your first question.

try this to check what day of week this is
----

$tstamp=mktime(0,0,0,$m,$d,$y);
$Tdate = getdate($tstamp);
$wday=$Tdate["wday"];

$wday will have 0 for sunday
upto 6 for saturday

----

I dont know what do you want to do with this but a simple thing would be running a loop from 1 to days of month.

start spitting empty cells,
if the date 1 is on current weekday spit the date as well. This will start printing the dates in calendar format.

Also check in that cell if a record matches to the new dat, spit that also.
every time wday is 6, spit next row after spitting the cell

[ ][ ][ ][ ][1 ][2 ][3* ][4 ]
[5*]

Hope you are starting to code it now, do ask if you are stuck again.