[SOLVED] Cronjob help
Moderator: General Moderators
Cronjob help
Hey all, I need some help. I am creating a game, I have almost everything sorted appart from the cronjobs. Ive already done the timing and everything its just the php code.
Could someone please tell me the code for this?
I want to allocate 2 'awake' to all the players.
Table: users
You cant get more than 100 awake. (I could sort that bit out).
I already have the 'include connect.php' at the top so theres no point bothering with the database connect info.
Could someone please tell me the code for this?
I want to allocate 2 'awake' to all the players.
Table: users
You cant get more than 100 awake. (I could sort that bit out).
I already have the 'include connect.php' at the top so theres no point bothering with the database connect info.
Cron is not a programming language, it is merely a scheduler which can be setup to run scripts/apps/system commands at any interval or time of day you want (similar to Windoze Task Scheduler).
You would write your script in whatever language you like and then configure cron to access and run the script whenever you like.
The information you have given so far is nowhere near enough to enable anyone to write a php script to do what you want.
It sounds like you want someone to write the script for you? in that case your post would have been better suited in the 'Volunteer Work' or 'Job Hunt' section.
You would write your script in whatever language you like and then configure cron to access and run the script whenever you like.
The information you have given so far is nowhere near enough to enable anyone to write a php script to do what you want.
It sounds like you want someone to write the script for you? in that case your post would have been better suited in the 'Volunteer Work' or 'Job Hunt' section.
This might make it clearer. This is what I want the script to do.
Select players from database;
if ($awake =< 98 )
{
$awake = $awake + 2;
}
I can make the script for one player, Im just having trouble selecting all the players from the database and using that script on all of them without visiting that page. Is that possible, or do I have to create a new table or something?
Select players from database;
if ($awake =< 98 )
{
$awake = $awake + 2;
}
I can make the script for one player, Im just having trouble selecting all the players from the database and using that script on all of them without visiting that page. Is that possible, or do I have to create a new table or something?
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
Code: Select all
UPDATE tablename SET awake = awake + 2 WHERE awake < 98Yeah, thanks... The full code i worked out is...
Code: Select all
<?php
include "connect.php";
$sql = "UPDATE users SET awake = awake +1 WHERE awake < 100";
$result = mysql_query($sql);
?>