Solved

Display number of events in a city from the database

Posted on 2011-10-01
5
302 Views
Last Modified: 2012-05-12
There is box on my home page (when logged in) that I want to display the following information:

(number) Parties in (city)

The CITY is the city that the user has entered in their account information (This is stored in a MySQL database).
The NUMBER needs to be the total number of events in that City listed in the database.

So an example would be:

53 Parties in London

I've got the CITY to display but I can't work out how to add up the total amount of events in that City and display them on my page.

If you need more information, just ask.

Your help is much appreciated.
Thanks.



0
Comment
Question by:PSTCAT
  • 2
  • 2
5 Comments
 
LVL 27

Accepted Solution

by:
yodercm earned 500 total points
ID: 36897567
SELECT City, COUNT(*) FROM Table GROUP BY City
0
 

Author Comment

by:PSTCAT
ID: 36897579
Could you elaborate a little more for me please?

that didn't seem to work.

Cheers.
0
 
LVL 11

Expert Comment

by:maeltar
ID: 36897581
mysql_num_rows()
0
 

Author Comment

by:PSTCAT
ID: 36897602
OH don't worry. I've been coding since 9am. My brain has turned to mush.

I've fixed the problem. thanks.
0
 
LVL 27

Expert Comment

by:yodercm
ID: 36897779
ok, glad you figured it out, happy to help :)
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Suggested Solutions

What is Node.js? Node.js is a server side scripting language much like PHP or ASP but is used to implement the complete package of HTTP webserver and application framework. The difference is that Node.js’s execution engine is asynchronous and event…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now