php - Cron job script not working -


so have cronjob script worked on godaddy php 5.4, in different host not work, tried different php versions too. have correct path cron, host support said did, presented me logs. maybe there problem script? adds energy points user account.

<?php include "../core.php"; //fuel refill (by default every 10 minutes)  $sqlusers = mysql_query("select * users banned='no'"); while ($rowuser = mysql_fetch_assoc($sqlusers)) {     if ($rowuser['fuel'] < $rowuser['fuelcapacity']) {         $userfuelrefill = mysql_query("update users set fuel=fuel+1 username='$rowuser[username]'");     } }  echo '<meta http-equiv="refresh" content="0;url=../garage">'; ?> 

mysql extensions deprecated try pdo approach:

<?php  require [full/script/path/]core.php; $pdo = new pdo([insert connection string]); $result = $pdo->query("select * users banned='no'")->fetchall(pdo::fetch_assoc); foreach ($result $row) {    if ($row['fuel'] < $row['fuelcapacity']) {      $query = "update users set fuel=fuel+1 username= :username";      $query = $pdo->prepare($query);      if ($query->execute(array(':username' => $row[username]))) {      } else { throw new exception('sql query failed [' . $query->errorcode . ']'); }    } } echo '<meta http-equiv="refresh" content="0;url=../garage">'; 

now of course there things have replace connection string , full path should work php pdo enabled.


Comments