Passing NULL to argument 3 of mysql_fetch_object has undefined behavior.