|
-
Oct 9th, 2006, 07:58 AM
#1
Thread Starter
Lively Member
[resolved]Num records in table (MySQL database manipulation with php)
Is there a way to get the number of entries (records, lines) in a table. I've been doing it a very ineffeciant way and I know I can't keep doing it. I've called Select (one column) from table then using msql_numrows on the result. There's got to be a better way. Also, if I can select the last entry it can tell me because it has a row with autoIncrements.
Last edited by vagabon; Oct 11th, 2006 at 09:17 AM.
-
Oct 9th, 2006, 10:41 AM
#2
Re: Num records in table (MySQL database manipulation with php)
Use the COUNT sql function.
And no, selecting the last entry and checking its ID does not give you a reliable count. For one, the ID could wrap around eventually. More importantly, it would still count deleted rows.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Oct 10th, 2006, 09:43 AM
#3
Thread Starter
Lively Member
Re: Num records in table (MySQL database manipulation with php)
Whats the exact name of the function? I looked up count but that didn't seem as if it would work.
-
Oct 10th, 2006, 11:14 AM
#4
Re: Num records in table (MySQL database manipulation with php)
Code:
SELECT COUNT(*) FROM tablename
As simple as it gets.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Oct 11th, 2006, 09:16 AM
#5
Thread Starter
Lively Member
Re: Num records in table (MySQL database manipulation with php)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|