Jump to content


Photo

Getting number of entries in a table


  • Please log in to reply
2 replies to this topic

#1 ReVeR

ReVeR
  • Members
  • PipPipPip
  • Advanced Member
  • 42 posts

Posted 21 March 2006 - 10:26 PM

Hello.
How can i get number of entries in a table?
I tried to use mysql_num_rows from a results, but that gives me too many....
any ideas how to get exect number of entries?
Thx

#2 hitman6003

hitman6003
  • Members
  • PipPipPip
  • Advanced Member
  • 1,807 posts

Posted 22 March 2006 - 01:54 AM

[!--quoteo(post=357119:date=Mar 21 2006, 05:26 PM:name=ReVeR)--][div class=\'quotetop\']QUOTE(ReVeR @ Mar 21 2006, 05:26 PM) View Post[/div][div class=\'quotemain\'][!--quotec--]
I tried to use mysql_num_rows from a results, but that gives me too many....
any ideas how to get exect number of entries?
Thx
[/quote]


Exact number of entries of what?

If you want the number of entries in the whole table, use the count funtion:

[!--sql--][div class=\'sqltop\']SQL[/div][div class=\'sqlmain\'][!--sql1--][span style=\'color:blue;font-weight:bold\']SELECT[/span] COUNT(id) FROM table [!--sql2--][/div][!--sql3--]

If you want to narrow it down, add a where clause to it.

#3 ReVeR

ReVeR
  • Members
  • PipPipPip
  • Advanced Member
  • 42 posts

Posted 22 March 2006 - 02:26 AM

thx alot, thast exectly what i needed. I guess i am still a complete news in this, but at least i am learning from this forum:D





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users