mysql_fetch_object(): supplied argument is not a valid MySQL result resource

What does this normally imply? No DB connection, No data in DB, bad field names?

Any ideas

Thanks.

    Could be any of the above. You should always check for errors from your mysql_query statement.

    function db_query($sql)
    {
      $result = mysql_query($sql);
      if (mysql_errno() == 0) return $result;
    
      die ('SQL ERROR ' . mysql_error() . '<br />' . htmlspecialchars($sql));
    }
    $query = "SELECT this FROM that";
    $result = db_query($query);
    
    /* At this point you know the query was executed.  
    It might not have the expected results but at least mysql did not choke on it */
      Write a Reply...