Results 1 to 3 of 3

Thread: Fixed problem to a program that runs as a cron job every night at 12AM

Hybrid View

  1. #1
    Join Date
    Sep 2009

    Question Fixed problem to a program that runs as a cron job every night at 12AM

    Every other night or so, I get this message:

    Warning: Invalid argument supplied for foreach() in /var/www/clienthost/orthospinereps.com/httpdocs/cron/employer_alerts/mail2.php on line 15

    I think it is just because I do not have any records to loop through with the foreach()?? Anyway, how can I prevent this error from displaying?


    #echo "m here <br>\n";

    $DIR = "/var/www/vhosts/orthospinereps.com/httpdocs/cron/employer_alerts";
    #$DIR = ".";

    require ("$DIR/../../include/ashish_functions.php");


    $result = getLatestJobs();

    //here is the line 15
    foreach ($result as $row) {

    //End Time= Now, Start Time = A Very Long Time ago...
    $row['end_time'] = time();
    $row['start_time'] = strtotime("10 September 2000");

    $uid= $row['user_id'];
    $sql2 = "SELECT * FROM `employers` WHERE `ID`=". $uid ." AND Validated=1 ";
    $result2 = mysql_query($sql2);
    $row2 = mysql_fetch_assoc($result2);
    $comp_key = md5 ($row2['Password'].$uid);
    $comp_key = substr($comp_key, 0,15);

    #$row['start_time'] = 0;

    If anybody knows how to fix this...please help me!

    Thank you!
    Kind Regards!

  2. #2
    Join Date
    Nov 2008
    It's impossible to say any more than the error message is already telling you. The getLatestJobs() function is not returning an array. That's the place to start looking.

  3. #3
    Join Date
    Sep 2009
    Thanks a lot. I will look.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center