-5

hi guys the query only return one rows even i have 12 rows. Please help

$connection = mysqli_connect("localhost","root","","database");
$qry="SELECT COUNT(*) as count FROM table";
$result=mysqli_query($connection, $qry);
2
  • 2
    COUNT is an aggregation function, it's going to aggregate all rows unless you use groupings. Commented Aug 17, 2018 at 16:53
  • You dont actually get the information that that query returns. You need to do some sort of fetch to get the actual count Commented Aug 17, 2018 at 17:29

1 Answer 1

-2

As Devon mentioned, COUNT is an aggregate function, so it will only return 1 row. If you want to retrieve all 12 rows, do:

SELECT * FROM table;
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.