473,765 Members | 2,047 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Inserting alternating event/appointment type using time and date range

41 New Member
Hi

I need help.

I know what I want to accomplish, but I do not know how to do it.

WHAT I NEED HELP ACCOMPLISHING:
How to do I insert data into a table for a date range of two or more months,
where every second or third week should be able to have different events/appointments.

POSSIBLE APPROACH:
I would like to choose a 7 day cycle/template, or to allow making the weeks
different with a 14 day or 21 day or 28 day cycle/template.

For example the 14 days cycle represents two weeks where every second week can be different.

Day# Day
1
2 Monday (meetings 1:00pm to 3:00pm)
3 Tuesday
4 Wednesday
5 Thursday (breakfast meeting 8:00AM to 9:00AM)
6 Friday
7
8
9 Monday (breakfast meeting 8:00AM to 9:00AM)
10 Tuesday
11 Wednesday (meetings 1:00pm to 3:00pm)
12 Thursday
13 Friday
14


The current code works well for a week or if every week is the same in the date range.
See below.

The availablity table store different event/appointment types using date and time range.
This event/appointment type information is then displayed to the user using a daily
schedule format.

HOW THE 7 DAY CYCLE DATA IS STORED:
Example: Meetings(event_ type_code) between 2:30 PM and 4:30 PM for Monday to Friday
this is stored in the "availablit y" table as seen below.

Note: A template group holds the different appointment types for the days of the
week as selected.

|group_id|start _time|end_time| start_date|end_ date | week_day|type_c ode
|26 |14:30:00 |16:30:00| 2007-12-03|2007-12-07| 550 | 201
|26 |14:30:00 |16:30:00| 2007-12-03|2007-12-07| 551 | 201
|26 |14:30:00 |16:30:00| 2007-12-03|2007-12-07| 552 | 201
|26 |14:30:00 |16:30:00| 2007-12-03|2007-12-07| 553 | 201
|26 |14:30:00 |16:30:00| 2007-12-03|2007-12-07| 554 | 201


CODE FOR ONE WEEK CYCLE
[php]
<?
$group_seg = array();

/*get group templates data to apply to schedule. This data contains
event/appointment types*/
$query = "SELECT distinct(s.seg_ id), s.model_id, w.group_id, s.event_type_co de,
s.time_from, s.time_to, w.weekday
FROM cal_group_week w, cal_day_segment s
WHERE s.model_id = w.model_id
AND w.group_id = '$group_id'
AND s.deleted = 'N'
AND w.deleted = 'N'";
$result = mysqli_query ($mysqli, $query);
while($row = mysqli_fetch_ar ray($result))
{
$group_seg[] = $row;
}


//loop through segment start and end time
foreach($group_ seg as $group_segment)
{
//database stored time from daily model segments
$start_time = $group_segment['time_from'];
$end_time = $group_segment['time_to'];
$group_id = $group_segment['group_id'];
$event_type_cod e = $group_segment['event_type_cod e'];
$day = $group_segment['weekday'];



/**-----------------------insert event type/appointment---------------------**/

$cal_query = "INSERT INTO availablity(
time_id, group_id, start_time, end_time,
start_date, end_date, week_day,
type_code)
VALUES(
null, '$group_id', '$start_time', '$end_time', '$start_date',
'$end_date', '$day', '$event_type_co de')";

mysqli_query($m ysqli, $cal_query)or die(mysqli_erro r($mysqli));

}//apply group


?>
[/php]
Dec 29 '07 #1
1 2016
assgar
41 New Member
Hi

I hope this better explains what I am trying to accomplish.

The events are recurring every month, but not recurring at the same time or on the same day of the week.

Thank
Dec 29 '07 #2

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

Similar topics

13
9304
by: perplexed | last post by:
How do you convert a user inputted date to a unix timestamp before insterting it into your database? I have a form, with a textfield for a date that the user inputs in the format mm-dd-yyyy and three dropdow boxes for hours, minutes, and AM/PM. All of these need to be considered together and converted to one Unix Timestamp and then inserted to the MYSQL date field. The type of field is INT (11) so that I can instead of the standard...
3
7519
by: Sam | last post by:
My db looks after the hiring and lending of equipment, the form which books out equipment hired prints a signout sheet and automatically inserts an appointment into outlook advising the operator on the due date that a particular hire is due. I have used microsoft's automated appointment code to do this, what I would also like the code to do is to email an appointment to the person hiring the gear. Knowing that you can email an...
3
1631
by: Lea | last post by:
Having a problem with a query within a table for appointment schedules. In this table tblMeetingInfo are two fields, StartDate and EndDate. The date information is entered into each of these fields like: 1/12/2005 (This could represent data entered into either field). Most appointments are one day in duration. In this example, StartDate would be equal to Enddate: 1/12/2005 to 1/12/2005 (StartDate to EndDate).
15
18894
by: Khurram | last post by:
I have a problem while inserting time value in the datetime Field. I want to Insert only time value in this format (08:15:39) into the SQL Date time Field. I tried to many ways, I can extract the value in timeonly format by using this command Format(now,"HH:mm:ss") But when I insert it into the Sql Server database, it embadded date value with it. the output looks like that "01/01/1900 08:59:00" in that case time is
6
2273
by: Joseph Geretz | last post by:
Writing an Outlook AddIn with C#. For the user interface within Outlook I'm adding matching pairs of Toolbar buttons and Menu items. All of the buttons and menu items are wired up to send events to the same method (aka delegate?). I use the Tag property within this method to determine what user action is taking place. Very simple: When adding toolbar button: tbButton.Click += new...
0
899
by: Srini | last post by:
Hello, I have a Generic List of values which is bound to a GridView List<AppointmentattendeesList = new List<Appointment>(); List<AppointmentOldattendeesList = new List<Appointment>(); Appointment attendees = new Appointment(); attendees.Email = txtExternal.Text; attendees.ContactID.ContactID = Model.ContactID.ContactID;
4
2616
by: keri | last post by:
Hello again, While I try and solve the calender issue I also have another problem. I have a form & table (appointments) where the user records appointments in the future. The fields include date, time and duration. I would like a pop up box to appear when registering an appointment if the time / days clash with another appointment. Somehow I need to create a table or query that blocks out sections of
3
1905
by: assgar | last post by:
Hi I am having problem with my loping. I don't know if I have chosen the correct approach. GOAL: I need to insert into a table event types for a specific date range. The calendar the event type is displayed on is divided into 15 minutes time intervals
15
3773
by: chicane | last post by:
I am using VS2008 and I trying to use the Range Validator for the following: I have a text box that a user will input a date into for an appointment - the date entered must be at least 7 days after the request has been made (current date) but less than 90 days into the future. I have set my range validator to Type = Date and Control to validate = Textbox11 I am now lost where the rest of the code goes to achieve the above?
0
9568
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
9399
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
10007
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...
1
9957
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8832
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
7379
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
5276
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3532
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2806
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.