473,657 Members | 2,397 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, 84 views)
Aug 30 '12 #1
0 1227

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

Similar topics

2
1386
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 possible to show the time which is been enter for the particular date be shown in the calender control which displays the date Thanks for replying me .
10
44861
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
1339
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 do it. Am a new person in trigger concepts.pls coding ..
3
1650
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 not null primary key ip_address - holds the ip address of the user browsing the site date - the particular date when the user was online on the website
1
1097
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
940
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 particular date in the event DateSelected Please can any one help me with changing the color of dates ... am badly stucked there.... Or do i have to create custom calender for serving the purpose? hiha
2
2567
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. in vb6 thsnks in advance
12
7370
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 t.tr_end_date between '2008-02-02' and '2008-02-29' and t.tr_start_time >='010000' and t.tr_end_time <='230000';
8
11171
by: rohitbasu77 | last post by:
Hi friends, how to see all the inserted rows of a particular date of a table. regards rohit
3
4976
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 March 8th and I click on "last full week", the date range would actually 03/01/10 - 03/06/10. The last full week starting on Sunday and ending on Saturday. If today is March 8th and I click on "last full month", the date range would be 02/01/10 -...
0
8399
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8312
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8827
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8732
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8606
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7337
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6169
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5632
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4318
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.