php - How to count records in sql database?
I know how to get the number of rows using mysql_num_rows. What i want to do is count each ip address, so i can count how many diffrent ip addresses are in my db. if that makes sense lol. cause there is just over 1,000 records. so let me show you a quick example.
say i have these ip addresses.
127.0.0.1 127.0.0.1 127.0.0.1 127.0.0.2 127.0.0.2 127.0.0.3 127.0.0.3
i want it to count 1 of each. and print 3 or whatever ammount i have in my database not count all which is what mysql_num_rows does and prints 7.
sorry if the title isn't very specific.
DISTINCTto count once. Not involving the duplicates. Try this query:
Use the MySQL Distinct Clause