ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Maybe, you should use a different name in the loop for the $query variable
because each time you make a mysql_fetch_assoc passing $query variable, the variable content has been modified inside the loop.
Hope this will help you.
In the example that you gave the variable $query was used to assist with two tasks simultaneously. First the collection of the different browsers held on the stats table and then then to gather the number of rows there are on that table. Because you had used the same variable name for both tasks when it returned to the while condition it was looking at the reply from the second sql call not the first. That is why you need to have two distinct variable names.
The "group by" will sort the result into groups, when it is used with aggregate functions, in this case count(*) the result is to give you the value of all the elements in that group, so by grouping by browser you will get the count of all the rows for each specific browser.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.