I have two tables countries, location whose fields are
_countries
countryid(Primary Key)
countryname
_location
locationid(primarykey)
locationname
countryid(Foreign key from countries table)
Every thing is done using JavaScript,AJAX and php that when a user selects a country from drop down list, locations against each country will be displaced but the mysql query is not working
I am Using the Below Query
$sql="SELECT _location.locationname, _countries.countryname FROM _location
INNER JOIN _countries ON _location.countryid='".$q."'";
//$q is the countryid selected from drop down list i got it through javascript and php
The drop down list is populated from the countries table
My Question is when a user selects a country name from the drop down list what will be
the mysql query that fetch the location name against each country name and display data like this
||Location name||Country Name||
Islamabad Pakistan
Karachi Pakistan
1 Answer