MySQL Forums
Forum List  »  Newbie

Re: Hit Counter
Posted by: Felix Geerinckx
Date: August 19, 2005 03:06AM

Cameron Habib wrote:

> $query="SELECT id FROM counter WHERE id > 0";
> $hits = mysql_query($query);
> echo "There are ".mysql_num_rows($hits)"";

To get the number of records in table, you do

SELECT COUNT(*) FROM counter;

When you use MyISAM tables, this is optimized and very fast.

--
felix
Please use BBCode to format your messages in this forum.

Options: ReplyQuote


Subject
Written By
Posted
August 18, 2005 08:50AM
Re: Hit Counter
August 19, 2005 03:06AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.