RE: [PHP] date problem
| From: | John Holmes | Date: | Thu, 06 Jun 2002 10:55:47 +0000 |
| Subject: | RE: [PHP] date problem | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-100921@lists.php.net to get a copy of this message | ||
> >> SELECT COUNT(*) AS c
> >> FROM users_table
> >> WHERE UNIX_TIMESTAMP( user_regdate ) > '1022882400'
> >
> > The only way you can do it with a char column is to select the
entire
> > database, load it into a PHP array, using strtotime() to (hopefully)
> > convert "May 29, 2002", etc, into a unix timestamp, and then sort by
> > that timestamp.
> >
>
> Alternatively you could use the query you are now (if its returning
the
> correct subset of rows from the table). Replace COUNT(*) AS c with
your
> primary key field (eg: id), and then use mysql_count_row() [rtfm for
more
> details] rather than pulling the rows. From here it looks like your
> fastest option, but your not providing enough information.
The query shouldn't be returning anything, b/c a unix_timestamp of a
char type column is going to be zero. So zero will never be >
1022882400.
Also, there is no MySQL_count_row(), function. Do you mean
MySQL_num_rows()? You should use COUNT(*) in your query instead of
MySQL_num_rows(), if the count is all your after.
---John Holmes...