>>> On Sáb 24 Ago 2002 11:19, Tony Harrison wrote:
>>> How would I count the number of rows in a mysql table with a WHERE
>>> clause?
> >
>> "Martín marqués" <[EMAIL PROTECTED]> wrote in message
> > news:[EMAIL PROTECTED]...
> > select count(*) from table_name WHERE .....
> >

>From: "Tony Harrison" <[EMAIL PROTECTED]>
> Sent: Saturday, August 24, 2002 5:54 PM
> Subject: Re: [PHP] Count number of rows in table.
>
> And do I need to use any other functions like mysql_fetch_row() ?
>

Yes.  It's a regular sql statement, so you must fetch the results.

$sql = "select count(*) from table_name WHERE .....";
$result = mysql_query($sql) or die(mysql_error);
$row = mysql_fetch_row($result);
$rowCount=$row[0];





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to