Hi Everyone,
I am using the following code (many thanks for the code folks BTW) to
generate 3 schedules in three tables one is a schedule with 7 day
intervals and two are daily schedules.
The two daily schedules seem to have out of sync dates at the start of
each schedule. The dates look as if they may be dates from the
preceding loop.
I am presuming that I need to reset something after the completion of
each loop but I am not sure what.
Many thanks
Darren
$now = time();
$day = $now + 7*24*60*60;
$cutoff = strtotime("+$mo nths months");
while ($day <= $cutoff) {
$date = date('Y-m-d', $day);
$insert = "INSERT INTO daily_data SET subscr_id='$sub scr_id',
date='$date'";
mysql_query($in sert);
$day = $day + 7*24*60*60;
}
//then create a daily schedule in the excercise table
for($i=0;$i<=($ sched);$i++)
mysql_query("IN SERT INTO exercise_data SET subscr_id='$sub scr_id',
date=date_add(n ow(),INTERVAL
LAST_INSERT_ID( ) DAY)");
//then create a daily schedule in the food and diet table
for($i=0;$i<=($ sched);$i++)
mysql_query("IN SERT INTO food_data SET subscr_id='$sub scr_id',
date=date_add(n ow(),INTERVAL
LAST_INSERT_ID( ) DAY)"); 1 1814
>I am using the following code (many thanks for the code folks BTW) to generate 3 schedules in three tables one is a schedule with 7 day intervals and two are daily schedules.
The two daily schedules seem to have out of sync dates at the start of each schedule. The dates look as if they may be dates from the preceding loop.
... date=dateadd(no w(), INTERVAL LAST_INSERT_ID( ) DAY) ...
This is absolutely wierd. Shouldn't that be INTERVAL 7 DAY?
After you have a lot of people sign up, LAST_INSERT_ID( ) is going
to be a couple hundred or thousand, and certainly isn't what you
want. I also note that you never seem to use $i within the loops.
Perhaps that's what you want instead of LAST_INSERT_ID( )?
You also never set $sched.
I am presuming that I need to reset something after the completion of each loop but I am not sure what.
Many thanks
Darren
$now = time(); $day = $now + 7*24*60*60; $cutoff = strtotime("+$mo nths months"); while ($day <= $cutoff) { $date = date('Y-m-d', $day); $insert = "INSERT INTO daily_data SET subscr_id='$sub scr_id', date='$date' "; mysql_query($in sert); $day = $day + 7*24*60*60; } //then create a daily schedule in the excercise table for($i=0;$i<=( $sched);$i++) mysql_query("IN SERT INTO exercise_data SET subscr_id='$sub scr_id', date=date_add( now(),INTERVAL LAST_INSERT_ID () DAY)"); //then create a daily schedule in the food and diet table for($i=0;$i<=( $sched);$i++) mysql_query("I NSERT INTO food_data SET subscr_id='$sub scr_id', date=date_add( now(),INTERVAL LAST_INSERT_ID () DAY)");
Gordon L. Burditt This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: raj chahal |
last post by:
Hi there,
I'm creating a access database for 'events'. I have created a field for
'date of event', the asp then checks if this date has lapsed, if so it
doen't show the event. All works fine.
The only problem is how do I manage dates that re-occur ? i.e every tuesday
or every 1st tuesay of the month.
The re-occuring event would have some general blurb that applies to all the
dates, but on some occations I may need to add new unique info...
|
by: MLH |
last post by:
Anybody's solution would be appreciated. Pls,
do not pause to write anything for this. I'm not
looking for that kind of a handout. I have an idea
about how to do it, but I wanted to see if anyone
has already done it and is proud of their achieve-
ment and willing to share it.
The courts order public sales of property in judgments
in my county. They require the auctioneers to schedule
future dates and advertise them (Sundays not...
|
by: atv |
last post by:
Hi,
is there something wrong with this code? It seems that it crashes
at the else { clause, when allocating a second record. Excuse for
the indentation, the g_warnings are from gtk.
Also, i'm using 2 pointers in the struct, which consists of 3 ints,
and 2 pointers, which i give 256 bytes each. Much to much ofcourse,
but it's just testcode.
The code doesn't even reach the g_warning in the { code.
|
by: Good Man |
last post by:
Hi there
I have a list of jobs scheduled in a MySQL table, with start dates and
end dates, like so:
SchedID | JobID | StartDate | EndDate |
----------------------------------------------
1 5 2006-05-08 2006-05-09
2 8 2006-05-10 2006-05-12
3 3 2006-05-01 2006-05-19
|
by: Greg |
last post by:
Hi,
I have a table with "dates", i'd like to display those dates on a calendar.
I've put a calendar in a form, linked to my "date" field, and it works, but
only showing one "date" per calendar.
I can see all "dates" moving to next records, but one per calendar. :-(
Ex: 17/06 on one claendar, then if i click on next record, I can see my
calendar with 24/06 ...etc ...
| |
by: josecruz |
last post by:
I have to create a summary report that will provide counts and # average of days for multiple "Status" by entering different dates for every criteria. I have created several queries that calculates the number of days and the counts. I have created the corresponding report to show the sum and verages. But I don't know how to make them print on a main report that will display the information of multiple status since I have to enter multiple...
|
by: Eamon |
last post by:
Hi all, I'm trying to find a way to list all the jobs/schedules due to run between two dates but all I seem to be able to get is a list of jobs with their NextRunTime.
Example:
Say I had two jobs. The first job runs hourly on the hour and the second runs daily at 2pm.
Now if it was now (26 Jan 2007 11:20am) and I want to find out what jobs will run between 12pm and 4pm on 1st Feb 2007, I would want a list something like this:
JobID |...
|
by: Ruben |
last post by:
Hi,
I have a continuous form that provides a listing of various
instruments that are
serviced on a monthly to annual basis, with general info about the
instrument, last and next service dates, etc.
What I am trying to do is create an On Open event procedure that will
identify all instruments that are listed with a string of either "Past
Due" or "Schedule Vendor" based on whether each of their respective
|
by: BeckR |
last post by:
Hello:
Thanks for reading my post. I am trying to generate Athletic League schedules using Access 2003 and Windows XP PRO. I am using DateSerial in a text box to print the game dates on the League schedule report. This is the control source for one of the dates on my report.
=DateSerial(Year(),Month(),Day(+7))
The problem I am having is that if the day is a Holiday then I do not want to print the schedule information for that...
|
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...
|
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...
| |
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...
|
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...
|
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();...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |