How to calculate the same lines in the comments table?
+---+------------+-------------+ | | user | comment | +---+------------+-------------+ | 1 | ed | comment1 | | 2 | ed | comment2 | | 3 | edn | comment3 | | 4 | dima | comment1 | +---+------------+-------------+ php should display the number 3, if I want to count the number of lines with the value ed . How can I do it?
The current request is:
$cout_user = mysqli_query($this->db, "SELECT id, user, COUNT(*) FROM comments GROUP BY user"); And how to implement the output of the number of rows counted?
COUNT(*) as count- Alex$cout_user = mysqli_query($this->db, "SELECT id FROM comments WHERE user = 'ed'"); echo mysqli_num_rows($cout_user);- Alexправильнее писать COUNT(*) as count- and maybe evenCOUNT(1) as count? - Alexey Shimansky