Page 1 of 2

auto generate

Posted: Tue Jul 25, 2006 8:56 pm
by desiree
help me guys..is it possible in php/mysql to automatically update records..
im doing an online system that will be used by an accountant, and the records shouLd update every month..well, "update automatically" every month.and i have no idea about it, im just new in php..i don't have enough knowledge for that.

this is my the scenario.

FIRSTNAME: Desiree LASTNAME: Anderson

PaymentCycle
--2006,July1-31

monthlyRate
--$1650

InstallationFee
--$300

Total
--$1950

on the month of august, the table should automatically be:

FIRSTNAME: Desiree LASTNAME: Anderson

PaymentCycle
--2006,July1-31
--2006,August1-31

monthlyRate
--$1650
--$1650

InstallationFee
--$300
--$00

Total
-$1950
-$1650

on the month of sept.

FIRSTNAME: Desiree LASTNAME: Anderson

PaymentCycle monthlyRate InstallationFee Total
--2006,July1-31 --$1650 --$300 -$1950
--2006,August1-31 --$1650 --$00 -1650
--2006,September ... ....

as you can see, every month a new record is being added in the system..weLL, that is my problem, i don't know how to do it.. :(

you know, i've been working on that for 1 week, searching for tutorials and asking questions in different forums, and i stiLL can't get any idea or answer..i just Learned php so..sorry for being stupid..im just a trainee, here and until now, i'm stiLL very unproductive with my work..my boss is starting to get impatient with me..T_T

Posted: Tue Jul 25, 2006 9:03 pm
by feyd
If they need to update without interaction, cron is the solution. With an interaction to start the update (one or many records, it doesn't matter) then you can incorporate it into scripts on the site.

Posted: Tue Jul 25, 2006 9:09 pm
by desiree
thank you but, what is cron?..i don't know that..im sorry..i have reaLLy no idea about it..i only know php basic..

Posted: Tue Jul 25, 2006 9:13 pm
by Burrito
do a search on this forum for cron, or search google.

cron is basically *nix's version of a task scheduler.

Posted: Tue Jul 25, 2006 9:16 pm
by desiree
THANKS.. :D

so cron is a tool??, how can i get a copy of it??..and is this "cron" works in mysql..

THANKS again..

Posted: Tue Jul 25, 2006 9:26 pm
by desiree
one more thing..i have searched cron in googLe and it says

"Cron is very simply a Linux module that allows you to run commands at predetermined times or intervals. In Windows, it’s called Scheduled Tasks. "

im using windows..so how is that??..

THANKS again..

Posted: Tue Jul 25, 2006 9:33 pm
by Burrito
look at your task scheduler in the control panel

Posted: Tue Jul 25, 2006 9:51 pm
by desiree
THANKS..

do you mean, scheduLed tasks??

then? what should i do??..

i really have no idea..

im so sorry.. :cry: :cry:

Posted: Tue Jul 25, 2006 9:53 pm
by Luke
Not to sound condescending... but are you saying your computer has Windows or your server? Because your computer's OS doesn't matter... it's the server that would run the task.

Posted: Tue Jul 25, 2006 9:55 pm
by Burrito
yeah scheduled tasks.

then create a task and point it to your script for the application to run.

you'll do something like this:

Code: Select all

c:\php\php.exe c:\inetpub\wwwroot\somewebsite\somefile.php

Posted: Tue Jul 25, 2006 9:55 pm
by feyd
I would suggest icron for Windows.

Posted: Wed Jul 26, 2006 12:35 am
by desiree
THANKS buyt i really don't get it..is this a downloadable tool??

because im currently in this site http://surguy.net/articles/icron.xml

and it says that i should download it..im afraid that it might have a virus..

THANKS..

Posted: Wed Jul 26, 2006 12:45 am
by RobertGonzalez
You could develop a routine within your scripts to check for updates that need to be made and perform those based on programmed criteria. As an example, I developed an app for work that allows a person to put an item on hold for purchase for two weeks. When their two weeks passed, as of midnight, their hold dropped off the item if the item had not been purchased.

This was done by checking all holds the first time the page was loaded by any user for any given day. If you want to handle this programmatically instead of through cron, then the logic should follow along the lines of what my app does. Just a suggestion.

Posted: Wed Jul 26, 2006 12:59 am
by desiree
The Ninja Space Goat wrote:Not to sound condescending... but are you saying your computer has Windows or your server? Because your computer's OS doesn't matter... it's the server that would run the task.
i just started my project..and im only using 1 computer..which means, what im using is windows and my server is also windows. im using xampp and mysql

Posted: Wed Jul 26, 2006 1:01 am
by desiree
Everah wrote:You could develop a routine within your scripts to check for updates that need to be made and perform those based on programmed criteria. As an example, I developed an app for work that allows a person to put an item on hold for purchase for two weeks. When their two weeks passed, as of midnight, their hold dropped off the item if the item had not been purchased.

This was done by checking all holds the first time the page was loaded by any user for any given day. If you want to handle this programmatically instead of through cron, then the logic should follow along the lines of what my app does. Just a suggestion.
that logic is what i want because i have no idea about cron..but i don't know where to start..sorry :cry: