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
https://forums.phpfreaks.com/topic/72651-solved-cron-jobs/
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
https://forums.phpfreaks.com/topic/72651-solved-cron-jobs/#findComment-366370
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.