RE: [PHP-DB] Errors getting count(*) result

From: Date: Thu, 17 Aug 2000 11:03:43 +0000
Subject: RE: [PHP-DB] Errors getting count(*) result
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-2119@lists.php.net to get a copy of this message
odbc_exec returns a statement handle (resourceid in PHP speak) you need to : $connect = odbc_connect("blah", "blah", "blah"); $cntquery = "SELECT count(*) FROM amazoncd AS MyCount"; $result = odbc_exec($connect, $cntquery); $value=odbc_result($result,"MyCount"); echo $value; _____ ~ Richard Allsebrook ~ Applications Developer and Webmaster Easysoft Limited, No3 The Embankment, Leeds, LS1 4BJ http://www.easysoft.com <http://www.easysoft.com> - http://www.cinema.com <http://www.cinema.com> "A computer lets you make more mistakes faster than any invention in human history - with the possible exceptions of handguns and tequila." _____ -----Original Message----- From: Ian Evans [mailto:ianevans@friedspamdigitalhit.com] Sent: Wednesday, August 16, 2000 6:02 PM To: php-db@lists.php.net 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

« previous php.db (#2119) next »