Re: Errors getting count(*) result
| From: | gstrein andreas | Date: | Wed, 16 Aug 2000 18:04:10 +0000 |
| Subject: | Re: Errors getting count(*) result | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-2092@lists.php.net to get a copy of this message | ||
hi,
your line
$result = odbc_exec($connect, $cntquery);
$result containss not your desired result
you have to retrieve it via.
so just do a
$myResult = odbc_fetch_row($result);
echo $myResult;
and its all as you expect;
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/_/ viva technologies
_/ gstrein andreas
"Always listen to the experts; they'll tell you what can't be done and why.
Then do it."
- Robert A. Heinlein
----- Original Message -----
From: "Ian Evans" <ianevans@friedspamdigitalhit.com>
To: <php-db@lists.php.net>
Sent: Wednesday, August 16, 2000 7:02 PM
Subject: [PHP-DB] Errors getting count(*) result
<scratching head>
Trying to get a count of records so I can do a random grab, but for some
reason I'm getting the wrong number back.
If I enter the SQL query SELECT count(*) FROM amazoncd into MS Query, I
get the right answer, which is 22.
If I use the following code to test the same query:
$connect = odbc_connect("blah", "blah", "blah");
$cntquery = "SELECT count(*) FROM amazoncd";
$result = odbc_exec($connect, $cntquery);
echo $result;
I get 2. Not 22. 2.
Very confused.
</scratching head>
--
Ian Evans
Chairman & Executive Producer
Digital Hit Entertainment
http://www.digitalhit.com
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net
For additional commands, e-mail: php-db-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net