PDA

View Full Version : stupid mysql count() question


doron
Tue 11th Jul '00, 12:38pm
I have the following code:

$votes=$DB_site->query_first("SELECT COUNT(userid) FROM pollvote WHERE pollid=$pollid")

doing the select statement via telnet brings 0, the above returns me 8. If I use query and not query_first, it returns an array, but how do I call on the result in that array?

Doron
(who thinks his brain crashed)

Mike Sullivan
Tue 11th Jul '00, 3:13pm
Make it this:
$votes=$DB_site->query_first("SELECT COUNT(userid) AS userid FROM pollvote WHERE pollid=$pollid");

And just call as $votes[userid]

[Edited by Ed Sullivan on 07-11-2000 at 03:14 PM]

doron
Tue 11th Jul '00, 5:09pm
duh! thanks!