The error...
Warning: mysql_fetch_assoc() expects
parameter 1 to be resource, boolean
given in
/home/andar/public_html/sistema/admin/cron.php
on line 19
$hoje = strtotime(date("d-m-Y"));
$db = new DBConfig();
$db -> config();
$db->conn();
$query = mysql_query("SELECT * FROM products WHERE auto_pub = ".$hoje) or die(mysql_error());
while($res = mysql_fetch_assoc($query)) {
$query = mysql_query("UPDATE products SET publicado = '0' WHERE auto_pub = ".$hoje) or die(mysql_error());
}
$db->close();
$query is used before the while and inside the while... Change the name of the variable to $query2, for example:
$hoje = strtotime(date("d-m-Y"));
$db = new DBConfig();
$db -> config();
$db->conn();
$query = mysql_query("SELECT * FROM products WHERE auto_pub = ".$hoje) or die(mysql_error());
while($res = mysql_fetch_assoc($query)) {
$query2 = mysql_query("UPDATE products SET publicado = '0' WHERE auto_pub = ".$hoje) or die(mysql_error());
}
$db->close();
Hope it helps.