auto generate

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

desiree
Forum Newbie
Posts: 10
Joined: Tue Jul 25, 2006 8:52 pm

auto generate

Post 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
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post 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.
desiree
Forum Newbie
Posts: 10
Joined: Tue Jul 25, 2006 8:52 pm

Post 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..
User avatar
Burrito
Spockulator
Posts: 4715
Joined: Wed Feb 04, 2004 8:15 pm
Location: Eden, Utah

Post by Burrito »

do a search on this forum for cron, or search google.

cron is basically *nix's version of a task scheduler.
desiree
Forum Newbie
Posts: 10
Joined: Tue Jul 25, 2006 8:52 pm

Post 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..
desiree
Forum Newbie
Posts: 10
Joined: Tue Jul 25, 2006 8:52 pm

Post 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..
User avatar
Burrito
Spockulator
Posts: 4715
Joined: Wed Feb 04, 2004 8:15 pm
Location: Eden, Utah

Post by Burrito »

look at your task scheduler in the control panel
desiree
Forum Newbie
Posts: 10
Joined: Tue Jul 25, 2006 8:52 pm

Post by desiree »

THANKS..

do you mean, scheduLed tasks??

then? what should i do??..

i really have no idea..

im so sorry.. :cry: :cry:
User avatar
Luke
The Ninja Space Mod
Posts: 6424
Joined: Fri Aug 05, 2005 1:53 pm
Location: Paradise, CA

Post 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.
User avatar
Burrito
Spockulator
Posts: 4715
Joined: Wed Feb 04, 2004 8:15 pm
Location: Eden, Utah

Post 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
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

I would suggest icron for Windows.
desiree
Forum Newbie
Posts: 10
Joined: Tue Jul 25, 2006 8:52 pm

Post 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..
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post 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.
desiree
Forum Newbie
Posts: 10
Joined: Tue Jul 25, 2006 8:52 pm

Post 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
desiree
Forum Newbie
Posts: 10
Joined: Tue Jul 25, 2006 8:52 pm

Post 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:
Post Reply