[eluser]gazza7364[/eluser]
[quote author="Lifekent" date="1363786231"][quote author="gazza7364" date="1363785321"][quote author="Lifekent" date="1363783334"]Hi, u just want to count all users?[/quote]
What the database does, is register users who come to a IT club at dinner each day and makes a record for each user.
I use two tables, users and it_club.
The it_club table keeps a record of which room and date the users use.
If I do a query for the users for a date range, say a month.
I get back users showing when he used the room and date, but if he used say, IT1 6 times, I would get back the same user 6 times with 6 different dates. All I want back is the user with the number of times he used the room. The query above works fine when used in phpmyadmin, showing the user name , room and number of times used.
When i used
Code:
echo "<pre>";
print_r($result);
echo "</pre>";
It shows the expected results.
I think its this part in the view whats causing the problem.
Code:
<?=$names->COUNT( it_club.user_id ) ?>
Is this the way it should be entered in the view?[/quote]
When u make a query and select "COUNT( it_club.user_id )" just add an alias, for example:
"SELECT COUNT( it_club.user_id ) as uvisits" and then in view u can access it with $names->uvisits.
If u don't have this in query just add it to SELECT statement[/quote]
Thanks, for your time that works perfect, I didn't know I could do that, we learn something every day.