Hello All -

I need some help. I've got a page that lists events (fairs, seminars, etc.) that have been registered by the user, I would like to find a solution that will list these events and next to them include the number of people that have registered to attend the event.

The way I've been going at it is to echo the events from one databse, but I haven't been able to echo the number of people that are registered in that event. Events and their details are in one database while the other database contains the people that have registered.

Something like ...

---------------------
Marketing for Educational Institutions .......... #
----------------------
Business Fair for Educational Institutions ...... #
----------------------

Where "Marketing for..." & "Business Fair for..." come from one database (seminars) and the # is the number of people that have registered for that event (coming from a database named "attendants".

I'm not sure how to do it, because the second term, the quantity of attendants, depends on the event that is listed...

Any help? Thanks in advance!

Without knowing your database table layouts, something like this will work for you:

select s.seminar, count(*) from attendants a, seminars s
where a.seminar = s.seminar
group by s.seminar

Thank you NettSite. What I ended up doing was adding a user count colum to one of the databases with an automatic number of 0. When a user was added the script updated that the number in that table to +1 (and if the participant was deleted, -1).

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.