Jump to content


Photo

Calendars


  • Please log in to reply
22 replies to this topic

#21 lional

lional
  • Members
  • PipPipPip
  • Advanced Member
  • 266 posts

Posted 22 January 2007 - 05:04 PM

No I am running php4 with mysql 4.0.
I will attach the code

<?php 
// Check for a Month Change submission 

if ($submit) { 

// Subtract one from the month for previous, add one for next 

if ($submit == "Prev") { 
$month_now--; 
} else { 
$month_now++; } 

$date = getdate(mktime(0,0,0,$month_now,1,$year_now)); 

} else { 
$date = getdate(); 
} 

$month_num = $date["mon"]; 
$month_name = $date["month"]; 
$year = $date["year"]; 
$date_today = getdate(mktime(0,0,0,$month_num,1,$year)); 
$first_week_day = $date_today["wday"]; 
$cont = true; 
$today = 27; 

while (($today <= 32) && ($cont)) { 
$date_today = getdate(mktime(0,0,0,$month_num,$today,$year)); 

if ($date_today["mon"] != $month_num) { 
$lastday = $today - 1; 
$cont = false; 
} 

$today++; 
} 

// allow for form submission to the script for forward and backwards 

echo" 
<form action=\"cal.php\" method=\"POST\" name=\"calendar\"> 

<input type=\"hidden\" name=\"month_now\" value=\"$month_num\"> 
<input type=\"hidden\" name=\"year_now\" value=\"$year\"> 

<tr><td  align=left><input type=\"submit\" name=\"submit\" value=\"Prev\"></td> 
    <td align=right><input 
type=\"submit\" name=\"submit\" value=\"Next\"></td> 
</tr>
</table>
<table width=530 height=5>
<tr>
<td align=center width=170>
<b>Rose room</b>
</td>
<td align=center width=170>
<b>Cream room</b>
</td>
<td align=center width=170>
<b>Turquoise room</b>
</td>
</tr> 
</table> 
</form> 
<table width=\"170\" border=\"1\" cellspacing=0 cellpadding=2 align=left> 
<tr><td colspan=\"7\">$month_name $year</td></tr> 
<tr><td>Su</td><td>M</td><td>T</td><td>W</td><td>Th</td><td>F</td><td>Sat</td></ 
tr>"; 

I hope this is enough of the code

Thanks

Lional

#22 lional

lional
  • Members
  • PipPipPip
  • Advanced Member
  • 266 posts

Posted 24 January 2007 - 10:00 AM

My calenders seem to work on php4 but not on 5, I am not sure why.
Here is my code, can someone please give my some assistance

<?php 
// Check for a Month Change submission 

if ($submit) { 

// Subtract one from the month for previous, add one for next 

if ($submit == "Prev") { 
$month_now--; 
} else { 
$month_now++; } 

$date = getdate(mktime(0,0,0,$month_now,1,$year_now)); 

} else { 
$date = getdate(); 
} 

$month_num = $date["mon"]; 
$month_name = $date["month"]; 
$year = $date["year"]; 
$date_today = getdate(mktime(0,0,0,$month_num,1,$year)); 
$first_week_day = $date_today["wday"]; 
$cont = true; 
$today = 27; 

while (($today <= 32) && ($cont)) { 
$date_today = getdate(mktime(0,0,0,$month_num,$today,$year)); 

if ($date_today["mon"] != $month_num) { 
$lastday = $today - 1; 
$cont = false; 
} 

$today++; 
} 

// allow for form submission to the script for forward and backwards 

echo" 
<form action=\"cal.php\" method=\"POST\" name=\"calendar\"> 

<input type=\"hidden\" name=\"month_now\" value=\"$month_num\"> 
<input type=\"hidden\" name=\"year_now\" value=\"$year\"> 

<tr><td  align=left><input type=\"submit\" name=\"submit\" value=\"Prev\"></td> 
    <td align=right><input 
type=\"submit\" name=\"submit\" value=\"Next\"></td> 
</tr>
</table>

Thanks

Lional

#23 Barand

Barand
  • Moderators
  • Sen . ( ile || sei )
  • 18,021 posts

Posted 02 December 2008 - 07:22 PM

here's one I wrote a couple of years ago (change data dates so they are current)

http://www.phpfreaks....html#msg397881

Oops!  sorry, replied to wrong post
If you are still using mysql_ functions, STOP! Use mysqli_ or PDO. The longer you leave it the more you will have to rewrite.

Donations gratefully received






moon.png

|baaGrid| easy data tables - and more
|baaChart| easy line, column and pie charts




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users