Im making a cron job and currently it diplays the result correctly but when it needs to update it fails.
Anyone have any ideas
PHP Code:<?php
//phpinfo();
$mysqli = new mysqli('-','-','-', "-");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
$result2 = "SELECT * FROM tblJobs order by DatePosted desc";
$result = mysqli_query($mysqli, $result2)
or die('Error querying database.');
while($row = mysqli_fetch_array($result))
{
$time = strtotime($row['DatePosted']);
$one_week_ago = strtotime('-30 days');
if( $time > $one_week_ago ) {
}else{
echo "<td>needs hiding</td>";
$tempff = $row['JobID'];
$update = "UPDATE tblJobs SET Show = 0 WHERE JobID = ".$row['JobID']."";
$result = mysqli_query($mysqli, $update);
}
}
?>


Reply With Quote
Bookmarks