I'm trying to set a simple cron script to do some database updating, and I'm pretty worthless with MySQL without ActiveRecord (I use CodeIgniter). I keep getting the error message,
mysql_fetch_object(): supplied argument is not a valid MySQL result resource
with the following code:
mysql_connect("localhost", "user", "pass") or die(mysql_error());
mysql_select_db("my_db") or die(mysql_error());
$query = "select visit_e_id, visit_e_type from visits";
$result = mysql_query($query)
or die("Query failed: ".mysql_error()." Actual query: ".$query);
while($row=mysql_fetch_object($result))
{
....
}
Like I said, I'm not that great with straight PHP and MySQL (would appreciate any advice on how to include some sort of framework or ActiveRecords that could be used as part of a cron job). Any thoughts?