title: mysql_fetch_object(): supplied argument is not a valid MySQL result resource
body: <p>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, </p>
  
  <pre><code>mysql_fetch_object(): supplied argument is not a valid MySQL result resource
  </code></pre>
  
  <p>with the following code:</p>
  
  <pre><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))
  {
       ....
  }
  </code></pre>
  
  <p>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?</p>