invalid resource for fetch_object??
| From: | Prince | Date: | Wed, 30 Apr 2003 16:39:43 +0000 |
| Subject: | invalid resource for fetch_object?? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-145814@lists.php.net to get a copy of this message | ||
i have this script in full:
<?php
include("conf.inc");
mysql_connect($host, $mysqluser, $mysqlpwd)||die(mysql_error());
mysql_select_db($db)||die(mysql_error());
mysql_query("select count(*) from prayer");
$total=mysql_affected_rows();
mysql_query("delete from prayer where Posted <= now()-interval 14 day");
$delete=mysql_affected_rows();
$status1=mysql_query("select version() as version, connection_id() as
connection, now() as time, benchmark(1, \"delete from prayer where Posted <=
now()-interval 14 day\") as bench");
$server1=mysql_fetch_object($status1);
$message="Hi...\n
The time is: $server1->time\n
connection id for this request: $server1->connection\n
server version: $server1->version\n
records found: $total\n
records deleted: $delete\n
The above stats were based on the following query:\n
\"delete from prayer where Posted <= now() -interval 14 day\"\n
The script that generated this message took $server1->bench seconds to
process\n
This mnessage is automatically generated.. don't reply to it.\n";
mail("aborka@wellstonmichigan.com", "Franklin nightly report", $message,
"From: system@franklin.org");
?>
on the $status1= line it takes the version number time and all that sort of
stuff and then does a query for a delete from a table it then takes the
select on the $status1 line and tries to do a fetch_object on the select but
for some reason i get a invalid resource for that function?? how come when i
can do the work manual but the php script says that?
would fetchJ_array or fetch_row be better for that?
also i get only 1 records found when it sends me mail about what the script
had done and found when i know there are 5 records in the table??