473,503 Members | 1,727 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how to put present or absent in particular date in one php calender ?

3 New Member
Expand|Select|Wrap|Line Numbers
  1. /* row for week one */
  2.   $calendar.= '<tr class="calendar-row">';
  3.  
  4.   $sql = "SELECT * FROM employee_attandance WHERE emp_id = '".$_SESSION['id']."' ";
  5.   $result = mysql_query($sql);
  6.   while($row = mysql_fetch_array($result))
  7.   {
  8.       $status = $row['status'];
  9.       $date =  strtotime($row['date']);
  10.       $day = date('d',$date);
  11.       $monthdb = date('m',$date);
  12.       $yeardb = date('Y',$date); 
  13.  
  14.  
  15.   /* print "blank" days until the first of the current week */
  16.   for($x = 0; $x < $running_day; $x++):
  17.     $calendar.= '<td class="calendar-day-np">&nbsp;</td>';
  18.     $days_in_this_week++;
  19.   endfor;
  20.  
  21.   /* keep going with days.... */
  22. for($list_day = 1; $list_day <= $days_in_month; $list_day++):
  23.     $calendar.= '<td class="calendar-day">';
  24.       /* add in the day number */
  25.  
  26.      if($day == $list_day && $monthdb == $month && $yeardb == $year)
  27.      {
  28.       $calendar.= '<div class="day-number">'.$list_day.'</div>Present';
  29.      }
  30.      else
  31.       $calendar.= '<div class="day-number">'.$list_day.'</div>';
  32.  
  33.       /** QUERY THE DATABASE FOR AN ENTRY FOR THIS DAY !!  IF MATCHES FOUND, PRINT THEM !! **/
  34.       $calendar.= str_repeat('<p>&nbsp;</p>',2);   
  35.     $calendar.= '</td>';
  36.     if($running_day == 6):
  37.       $calendar.= '</tr>';
  38.       if(($day_counter+1) != $days_in_month):
  39.         $calendar.= '<tr class="calendar-row">';
  40.       endif;
  41.       $running_day = -1;
  42.       $days_in_this_week = 0;
  43.     endif;
  44.     $days_in_this_week++; $running_day++; $day_counter++;
  45.   endfor;
  46.   }
  47.   /* finish the rest of the days in the week */
  48.   if($days_in_this_week < 8):
  49.     for($x = 1; $x <= (8 - $days_in_this_week); $x++):
  50.       $calendar.= '<td class="calendar-day-np">&nbsp;</td>';
  51.     endfor;
  52.   endif;
  53.  
  54.   /* final row */
  55.   $calendar.= '</tr>';
  56.  
  57.   /* end the table */
  58.   $calendar.= '</table>';
  59.  
  60.   /* all done, return result */
  61.   return $calendar;
  62. }
  63.  
Attached Images
File Type: jpg er.jpg (35.7 KB, 83 views)
Aug 30 '12 #1
0 1210

Sign in to post your reply or Sign up for a free account.

Similar topics

2
1379
by: jack | last post by:
Hi, Im creating a attendence project for which im using a callender control .. in this im making the user to click on the button with will enter the current date and time in the database . is it...
10
44846
by: vin2sara | last post by:
Hi, Can anyone send a query to get present date and time ??I used dateformat method ,but i am not getting that.please its very urgent to me... Thank You
1
1326
kiss07
by: kiss07 | last post by:
Hi, I want to create a trigger in my applications. my recruitment is following: In a table emp every month particular(example 5th of every month) date is execute a trigger. How can i...
3
1643
by: dream2rule | last post by:
Hello All, I have a table where i am maintaining the users' ip address and the date when they are accessing the website. so its like i have 3 fields in the table like ip_id - auto_increment...
1
1090
by: tapanrout | last post by:
I want to make a calender in which i want to display the event of a particular date retreving from database and also to hav a mouse over to show some text of the event.
0
934
by: hiha | last post by:
Hi ! I wanted to change color of dates or encircle them when they are being selected in builtin control MonthCalender in vb2005. I could only make them see in bold font when we select the...
2
2559
by: charvi | last post by:
hi Is there a way to get the Day(like sunday, monday) from a Date Variable using VB.Net without using a switch case after getting the integer value from DateVal.DayOfWeek, some sort of direct way....
12
7357
by: crs27 | last post by:
Hai All, i want to retrive records from a table between perticular datetime range. the query is select * from geo_trip_history where t.tr_start_date between '2008-02-02' and '2008-02-29' and...
8
11137
by: rohitbasu77 | last post by:
Hi friends, how to see all the inserted rows of a particular date of a table. regards rohit
3
4964
by: anuragrathor | last post by:
I have a "Date Range" Section, with these three items:- Last full week; Last full month; Last full quarter. I want to get the data depending upon the selection of the Date Range. If today is...
0
7203
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7334
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6993
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7462
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5579
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5014
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4675
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3168
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
383
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.