Solved

Display number of events in a city from the database

Posted on 2011-10-01
5
343 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 27

Accepted Solution

by:
Cornelia Yoder 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:Cornelia Yoder
ID: 36897779
ok, glad you figured it out, happy to help :)
0

Featured Post

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

JavaScript has plenty of pieces of code people often just copy/paste from somewhere but never quite fully understand. Self-Executing functions are just one good example that I'll try to demystify here.
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 one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

621 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