Re: Re: count
| From: | Mike | Date: | Thu, 11 Apr 2002 11:12:59 +0000 |
| Subject: | Re: Re: count | ||
| References: | 1 2 3 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-18430@lists.php.net to get a copy of this message | ||
<?
$result = mysql_query("SELECT COUNT(id) as id FROM table);
$myrow = mysql_fetch_array($result);
print "$myrow[id]";
?>
Mike
----- Original Message -----
From: "Ron Allen" <allenr@fwd.areur.army.mil>
To: <php-db@lists.php.net>
Sent: Thursday, April 11, 2002 7:13 AM
Subject: [PHP-DB] Re: count
> I know how to get the results for the total number of records
> select count(*) from $table
> but how do I put them into a variable for me to use later???
>
> "David Robley" <robleyd@paradise.net.nz> wrote in message
> news:MPG.172032f7880e5ab69896eb@news.php.net...
> > In article <20020411104550.8417.qmail@pb1.pair.com>,
> > allenr@fwd.areur.army.mil says...
> > > I would like to count all the total records from a database. How
would
> I go
> > > about doing that???
> >
> > Do a COUNT * on each table and total the results? Although the results
> > may actually not mean much depending on your DB structure. Or do you
> > really mean count records in a _table_?
> >
> > --
> > David Robley
> > Temporary Kiwi!
> >
> > Quod subigo farinam
>
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.330 / Virus Database: 184 - Release Date: 2/28/02