Current location: Hot Scripts Forums » Programming Languages » PHP » add a number every 30 minutes


add a number every 30 minutes

Reply
  #1 (permalink)  
Old 08-30-04, 10:14 AM
Dion's Avatar
Dion Dion is offline
Newbie Coder
 
Join Date: Jun 2004
Location: NL
Posts: 60
Thanks: 0
Thanked 0 Times in 0 Posts
add a number every 30 minutes

I have a mysql database with my php website, and 1 of the fields in my database is a number.
Every 30 minutes a number has to be added to the previous number

Ex.
time=10.00 number=5
time=10.30 number=6
time=11.00 number=7


I know how to add a number to the database number using SET, but how can I make the code in a way that the number is added every 30 minutes??


thanks in advance

Dion
__________________
just a n00b trying to learn php
Reply With Quote
  #2 (permalink)  
Old 08-30-04, 05:34 PM
RynO RynO is offline
Newbie Coder
 
Join Date: Sep 2003
Posts: 35
Thanks: 0
Thanked 0 Times in 0 Posts
Well, depending on your server access and your operating system, you could set a cron job up to operate every 30 minutes.

That's what I do on my site and it works pretty good.

If you have cpanel than just scroll down to the cron job icon.
Reply With Quote
  #3 (permalink)  
Old 08-31-04, 12:38 AM
Dion's Avatar
Dion Dion is offline
Newbie Coder
 
Join Date: Jun 2004
Location: NL
Posts: 60
Thanks: 0
Thanked 0 Times in 0 Posts
what do you mean with cpanel?
and do you have to install something to get cron or is it standard php?
__________________
just a n00b trying to learn php
Reply With Quote
  #4 (permalink)  
Old 08-31-04, 12:41 AM
jamslam jamslam is offline
Newbie Coder
 
Join Date: Aug 2004
Posts: 29
Thanks: 0
Thanked 0 Times in 0 Posts
cPanel is an administration tool used to help administate your site. Your best bet would be to ask your host if you have cPanel, and subsequently ask your host if cron jobs are allowed (cron jobs aren't dependant upon cPanel).

Cron Jobs also aren't directly related to PHP- cron jobs is simply a way of 'executing a file every timeframe'...
Reply With Quote
  #5 (permalink)  
Old 08-31-04, 12:43 AM
Dion's Avatar
Dion Dion is offline
Newbie Coder
 
Join Date: Jun 2004
Location: NL
Posts: 60
Thanks: 0
Thanked 0 Times in 0 Posts
well, uhm asking my host is a bit of a prob. I'm using apache to host it myself, so...
__________________
just a n00b trying to learn php
Reply With Quote
  #6 (permalink)  
Old 08-31-04, 12:52 AM
<?Wille?> <?Wille?> is offline
Junior Code Guru
 
Join Date: Jan 2004
Location: Helsinki, Finland
Posts: 666
Thanks: 0
Thanked 0 Times in 0 Posts
well.. you could also make a small snippet to check current time (mktime) in the beginning of your view table script and if 30mins have elapsed then add the number.. if 1 hour add 2 numbers.. this will make it seem like its adding every 30mins becourse everytime someone trys to view the table contents it adds the numbers if enough time has elapsed..
hope it helps
Wille
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Directory script allowing to add links to multiple categories PaLNetweb PHP 0 08-21-04 03:16 PM
flash asp/acccess db add kobalt7 ASP 1 05-23-04 05:37 PM
Add sequential number to database from checkbox ajndede ASP 1 05-04-04 07:43 AM
cant add more than 1 mysql table with php script chrisb62 PHP 1 04-27-04 04:00 AM
How to adjust number of columns generated by php classifieds script? robertisunemployed PHP 0 02-28-04 02:40 PM


All times are GMT -5. The time now is 04:24 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.