smithb24
03-10-2005, 10:17 PM
I'm trying to find a way to count a MYSQL database's rows. I did the auto generated numbers, however, that doesn't work when you delete an item. It then just skips the item. (so now, it'd go, 1, 2 ,3, 5, 6, 7, if you deleted 4) So I was thinking, if I could throw this into an array, I could count that, and then I'd be set! Does anyone know how to do that?
NogDog
03-10-2005, 10:20 PM
Easiest way is:
SELECT COUNT(*) FROM table_name;
smithb24
03-10-2005, 10:24 PM
can you explain what that would do?
It just count the number of rows the query found.
NogDog
03-11-2005, 09:14 AM
Originally posted by smithb24
can you explain what that would do?
In SQL, SELECT * FROM table_name; returns all rows in the specified table. Using the COUNT() function instead just returns the number of rows returned by the query.