Jump to content

[SOLVED] Cron Jobs


supanoob

Recommended Posts

Is is possible to use Rand in crons? the current script i have is this:

 

<?php
$dbh=mysql_connect ("localhost", "user", "pass") or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ("user");

$query="select fish_x, fish_y from game_stats";
$result=mysql_query($query);
if (!$result)
{
die(mysql_error());
}
$num_rows=mysql_num_rows($result);

$row=mysql_fetch_array($result);
$fish_x=($row['fish_x']);
$fish_y=($row['fish_y']);

$rand_x=rand(1,5);
$rand_y=rand(1,5);

$rand_x=$rand_x;
$rand_y=$rand_y;

$sql2="UPDATE game_stats SET fish_x=$rand_x, fish_y=$rand_y";
if(mysql_query($sql2))
{
echo $sql2;
}

?>

 

yeah it doesnt seem to update them ><

Link to comment
Share on other sites

Cron just calls scipts / programs at specific intervals. What those scripts / programs do has nothing at all to do with cron.

 

The problem is more likely to do with your queries. You need to debug the script prior to having it executed by cron. Are you getting any errors?

Link to comment
Share on other sites

Like I said, you need to debug the scrit prior to having it executed via cron.

 

Your problem however might actually be that cron isn't executing the script. Can wee see your crontab?

 

the ones the cronjob sends for you.

 

Cron does not send emails. Like I said, Cron just calls scipts / programs at specific intervals. Thats all it does. If your meant to recieve an email when a cronjob is run, this is done by some other meens/configuration.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.