[UPHPU] How to get a count out of mysql.

District Webmaster webmaster at alpine.k12.ut.us
Thu Jun 17 11:33:43 MDT 2004


Using sql definitely the way to go for this -- whenever you can do
something in SQL, rather than PHP, do it. It's invariably faster, more
effecient, and a more correct result set. I used to do a lot of work in
php to mimic joins -- until I discovered joins (and my life has been
vastly better ever since).

Dave

>>> "Jon Jensen" <jjensen at debonairesolutions.com> 06/17/04 11:25 AM >>>
You can do it w/ just one SQL statement:

SELECT COUNT(field4) AS numrows,field4 FROM ezmail GROUP BY field4

That'll give you a result set like this:

numrows	field4
931		AL
104		AK
2356		AZ
...

Jon


---------------------------------------------------------------------
To unsubscribe, e-mail: list-unsubscribe at uphpu.org
For additional commands, e-mail: list-help at uphpu.org






More information about the UPHPU mailing list