View Single Post
ישן 22-10-05, 13:24   # 1
eawf
חבר חדש
 
מיני פרופיל
תאריך הצטרפות: Oct 2005
הודעות: 20

eawf לא מחובר  

[php] עזרה בבניית מערכת לוח שנה.

שלום, אני מנסה לבנות מערכת לוח שנה ולהלן הקוד ::


PHP קוד:
<html dir=rtl>
<link rel="stylesheet" type="text/css" href="style.css">
<style type="text/css">  
                               <!--  
                               th { font-size:12pt;  
                               line-height:14pt;  
                               font-family:Helvetica,Arial;  
                               }  
                               //-->  
                               </style>  
                               <?  
                               $mon 
$_GET['month'];
                               if(!
$mon){
                               
$mon date("m");
                               
$mmm $mon;
                               }
                               else{
                               
$mmm $mon;
                               }
                               if(
$mon 12){
                               
$year date("Y");
                               
$mo $mon/12;
                               
$year $year+$mo;
                               
$mon $mon-12;
                               }
                               else{
                               
$year date("Y");
                               }
                               print(
"<table border='1' cellpadding='0' cellspacing='0' style='border-collapse: collapse; border-width: 0' bordercolor='#111111' width='98%' id='AutoNumber1' height='12'>\n");  
                               for(
$month=$mon;$month<$mon+1;$month++) { 
                               
printf("<tr bgColor='#ca9e61'>\n<th colspan='7'>"); echo("$year"); printf("&nbsp;%s</th></tr>\n",date("F",mktime(0,0,0,$month,1,$year)));  
                               
printf 
("<tr bgcolor='#86BD6F'><th>ראשון</th><th>שני</th><th>שלישי</th><th>רביעי</th><th>חמישי</th><th>שישי</th><th>שבת</th></tr>");  
                               
$fdom=date("w",mktime(0,0,0,$month,1,$year));  
                               
$ct=0;  
                               for(
$row=1;$row<7;$row++)  
                               {  
                               print(
"\n<tr bgcolor='#BBDA96'>");  
                               for(
$week=1;$week<8;$week++)  
                               {  
                               
$ct++;  
                               
$value=mktime(0,0,0,$month,$ct-$fdom,$year);  
                               if (
date("m",$value)==$month)  
                               {  
                               
printf ("<th bgcolor='#BBDA96'>%s</th>",date("d",$value));  
                               }  
                               else { print(
"<td></td>"); }  
                               }  
                               print(
"</tr>\n");  


//--------------------------------------------



                               
$cr=0;  
                               print(
"\n<tr>");  
                               for(
$wek=1;$wek<8;$wek++)  
                               {  
                               
$cr++;  
                               
$valu=mktime(0,0,0,$month,$cr-$fmom,$year);  
                               if (
date("m",$valu)==$month)  
                               {  
                               
printf ("<th height='71'></th>");  
                               }  
                               }  
                               print(
"</tr>\n");  
                               

//--------------------------------------------

                               
}  
                               print(
"<tr align='middle'><td colspan='7'>");

           
        echo 
"<a href=\"" $PHP_SELF "?month=" . ($mmm 1) . 
        
"\">לחודש הקודם</a>";
        
$xyz 0;
while(
$xyz 7){
$xyz++;
echo(
'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;');
}

           echo 
"<a href=\"" $PHP_SELF "?month=" . ($mmm 1) . 
        
"\">לחודש הבא</a>";




print(
"</td></tr>");  

                               }  
                               print(
"</table>");  
                               
?>

המערכת עובדת טוב, אבל אני רוצה שיהיה ניתן להציג מידע בתאריכים מסויימים שימצאו בתוך מסד הנתונים (SQL).
ולהציגם בתאריך הרצוי (שגם יהיה בתוך מסד הנתונים) בעזרת mysql_fetch_array();
כבר יש לי טופס שמכניס מידע ותאריך מסויים, אבל לא הצלחתי להציג אותו ביימים הרצויים אלא בכל הימים ביחד.

אשמח לקבל עזרה בכדי להציג את המידע בתאריכים הרצויים.
  Reply With Quote