Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Post New Thread Reply

Register GFY Rules Calendar
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed.

 
Thread Tools
Old 12-16-2011, 12:59 PM   #1
eMonk
Confirmed User
 
Industry Role:
Join Date: Aug 2003
Location: Canada
Posts: 2,310
What type of MYSQL JOIN do I need

My old query was:

Code:
$query = "SELECT city_name FROM city WHERE province_id = 9";
Now I'm using:

$city = $_GET['city'];

and just have the city name now but need to fetch all the cities in the province that $city is in.

Here are my tables:

Code:
Table: city
column: city_name = Vancouver, Victoria, Edmonton
column: province_id = 9, 9, 8

Table: province
column: id = 8, 9
column: name = Calgary, British Columbia
So if $city is in province British Columbia, what type of join to I need to fetch all cities listed in British Columbia?
eMonk is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 12-16-2011, 01:41 PM   #2
nm_
Confirmed User
 
Industry Role:
Join Date: May 2011
Location: San Diego
Posts: 328
SELECT city_name FROM city WHERE province_id IN (SELECT province_id FROM city WHERE city_name = $city) ???

Last edited by nm_; 12-16-2011 at 01:47 PM..
nm_ is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 12-16-2011, 02:01 PM   #3
eMonk
Confirmed User
 
Industry Role:
Join Date: Aug 2003
Location: Canada
Posts: 2,310
That worked thanks!
eMonk is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 12-16-2011, 03:41 PM   #4
Adult Insider Dave
Confirmed User
 
Adult Insider Dave's Avatar
 
Join Date: Jun 2005
Posts: 533
If you ever need major coding help contact me anytime!
__________________
Promote our penis growth and acne books, earn 75% on sales and rebills.

Contact me if you want a custom backend like Pornstarbucks and Freenetpass integrated with any billing gateway:
Adult Insider Dave is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Post New Thread Reply
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >

Bookmarks



Advertising inquiries - marketing at gfy dot com

Contact Admin - Advertise - GFY Rules - Top

©2000-, AI Media Network Inc



Powered by vBulletin
Copyright © 2000- Jelsoft Enterprises Limited.