Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Automatically updating database
Old 11-02-2004, 11:41 AM Automatically updating database
Manson's Avatar
Super Talker

Posts: 106
Location: South Wales, UK
Trades: 0
I want to create a timer so that every hour, it automatically updates the database.

E.G. I need it to add 1 every hour to the amount of hours passed every hour (obviously).

I have tried using date("H:i:s") and if statements to see if that worked but it didn't. Anyone have any ideas? I had a look at the other topic of automatically emailing something and followed the link but I was like a needle in a haystack!! Had no idea where I was.

If anyone has an idea please feel free to help me!

Thanks,

Manson
__________________
Admin of
Please login or register to view this content. Registration is FREE
Manson is offline
Reply With Quote
View Public Profile Visit Manson's homepage!
 
 
Register now for full access!
Old 11-02-2004, 12:07 PM
Anacrusis's Avatar
Defies a Status

Posts: 2,099
Name: Adam
Location: Colchester CT
Trades: 0
The best way to do it would be to write the script that does the update, and then setup a cronjob to execute that script every hour.

SQL to update the database:
Code:
Update MYTABLE set DATE_FIELD = now();
Anacrusis is offline
Reply With Quote
View Public Profile
 
Old 11-02-2004, 02:09 PM
Manson's Avatar
Super Talker

Posts: 106
Location: South Wales, UK
Trades: 0
That's the thing though, I don't understand the CRON thing. I get how to add the timing etc just not how to set it up. Like where do I save it (if i save it) and what path I have to use etc. I am very confused if you hadn't guessed.

Also would my host support it? http://www.bargain-hosting.net/index-6.html
__________________
Admin of
Please login or register to view this content. Registration is FREE

Last edited by Manson; 11-02-2004 at 02:24 PM..
Manson is offline
Reply With Quote
View Public Profile Visit Manson's homepage!
 
Old 11-02-2004, 02:36 PM
WaHoOoO!'s Avatar
Mentally Unstable Tugboat Captain

Posts: 797
Name: Chad
Location: /usr/bin/perl
Trades: 0
Reading their datacenter info and whatnot...it sounds fake...but that's beside the point.

I'm not sure. I'm not experienced with hosting on a Windows platform. Can "crons" (or a Windows equivalent) even be run in a Windows environment?
__________________
He's baaaaaaaack....
WaHoOoO! is offline
Reply With Quote
View Public Profile Visit WaHoOoO!'s homepage!
 
Old 11-02-2004, 03:14 PM
Anacrusis's Avatar
Defies a Status

Posts: 2,099
Name: Adam
Location: Colchester CT
Trades: 0
My apologies, I assumed you were on a *nix system.

Windows has a task schedular, but most hosting companies don't give their customers access to that. Unless they set something up custom for thier customers. I don't know of a "cron" workaround on windows.

You have a couple options I guess
1. move to a host that supports crontabs (most linux hosts do), they'll even help you set it up I'm sure.
2. contact your current host and see if they offer you any options.
3. If you have a friend using a linux host, ask them to setup a cronjob on their account that will execute your script.

A cronjob or something similar is the only way to execute a script at set intervals. I too had this problem a while ago when I was running a site on a windows server, I ended up signing up for a cheap linux hosting account and using the cron job there.
Anacrusis is offline
Reply With Quote
View Public Profile
 
Old 11-02-2004, 03:32 PM
Manson's Avatar
Super Talker

Posts: 106
Location: South Wales, UK
Trades: 0
Ok thanks. I will see about getting a new host. I was planning to anyway as I am currently using my works host as I develop the coding etc.
__________________
Admin of
Please login or register to view this content. Registration is FREE
Manson is offline
Reply With Quote
View Public Profile Visit Manson's homepage!
 
Reply     « Reply to Automatically updating database
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.23596 seconds with 12 queries