Any hints or pointers would be appreciated! thank you When the dates change my calendar gets thrown off. The daynames and dates are not matching up. I tested this by simply adding and subtracting 1 from the SQL call curdate() +1 or curdate() -1. Shouldn't I be able to manipulate the @weeks_anonymous array using the SQL call select dayofweek(curdate()); rather than using hardcoded undef's?
Here is my code: #!/usr/bin/perl use strict; use warnings; require "dbi-lib.pl"; use CGI qw/:standard *table start_ul/, (-unique_headers); use CGI::Carp qw(fatalsToBrowser); use DBI; my $cgi = new CGI; local $sth; #----------------------# # Function calls # #----------------------# print_header(); initialize_dbi(); #----------------# # Begin Main # #----------------# print $cgi->header(), $cgi->start_html ('SQL Lesson11'), $cgi->h1 ({-style=>'Color:blue'},'SQL Class'); print "<u>",$cgi->strong('Date/Time CGI Table:'),"</u><p>"; print $cgi->caption('MySQL calendar table output, Lesson 11:'); print "<p>"; run_statement( "select date_format(curdate(), '%b %e, %Y');" ); my $today = $sth->fetchrow; run_statement("select dayofweek(curdate() );" ); my $dayofweek = $sth->fetchrow; print $dayofweek; #&run_statement( "select date_format(curdate()-2,'%W');" ); #my $twodayago = $sth->fetchrow; #print "$twodayago <p>"; my @WeekDays = qw(Sunday Monday Tuesday Wednesday Thursday Friday Saturday); my ($day,$week,) = (0,0); my (@weeks, @weeks_anonymous,) = ((),()); foreach $day ('-15' .. '15') { run_statement( "select date_format(date_add(curdate(), interval '$day' day), '%b %e, %Y');" ); push (@weeks, $sth->fetchrow); } ## Begin Table ## print table({border=>undef}); print Tr ({-align=>'CENTER',-valign=>'TOP'}, td ([EMAIL PROTECTED])); @weeks_anonymous = ( [ undef, undef, $weeks[0], $weeks[1], $weeks[2], $weeks[3] ], [ $weeks[4], $weeks[5], $weeks[6], $weeks[7], $weeks[8], $weeks[9], $weeks[10] ], [ $weeks[11], $weeks[12], $weeks[13], $weeks[14], $weeks[15], $weeks[16], $weeks[17] ], [ $weeks[18], $weeks[19], $weeks[20], $weeks[21], $weeks[22], $weeks[23], $weeks[24] ], [ $weeks[25], $weeks[26], $weeks[27], $weeks[28], $weeks[29], $weeks[30], $weeks[31] ], ); foreach $element (@weeks_anonymous) { print Tr({-align=>'CENTER',-valign=>'TOP'}); for $date (@{$element}) { if (! defined $date) { print td (''); } elsif ($date eq $today) { print td(strong($date)); } else { print td ($date); } } print $cgi->end_Tr; } print $cgi->end_html; ____________________________________________________________________________________ Be a PS3 game guru. Get your game face on with the latest PS3 news and previews at Yahoo! Games. http://videogames.yahoo.com/platform?platform=120121 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/