NYCPHP Meetup

NYPHP.org

[nycphp-talk] mysql_num_rows() redux

Chris Shiflett shiflett at php.net
Mon Feb 23 16:34:51 EST 2004


--- Chris Bielanski <Cbielanski at inta.org> wrote:
> I *know* this has to have been covered before, but when you have
> ostensibly no data in MySQL (that damn single row full of nulls)
> what's the proven method forresolveing the count as zero? Obviously,
> as I'm sure most of you know, you get a result of 1 even if there
> is no "real" data in a MySQL table.

I assume you mean that mysql_num_rows() will return 1 when there is 1 row,
regardless of the data. This is good. Worse would be for the function to
be incorrect.

If you want to check whether a certain field is null, do it in your SQL
statement:

select foo from bar where blah is not null

Hope that helps.

Chris

=====
Chris Shiflett - http://shiflett.org/

PHP Security - O'Reilly
     Coming mid-2004
HTTP Developer's Handbook - Sams
     http://httphandbook.org/
PHP Community Site
     http://phpcommunity.org/



More information about the talk mailing list