help with a mysql query
Posted: Tue Jul 07, 2009 1:03 pm
hello, I am trying to create a form that will query mysql to result in defining a location(three in all: country, state, city). This is all based upon drop down bars and so far I have the country select already working. It is controlled through javascript and I am not to sure if this is my problem why as I contunue, nothing is working. (do not know any javascript).
This question is directed towards the query that is for the state drop down. $countryfix = $countryList[$selected country];. print_r($countryfix) works great!It keeps up with every country as selected, although when I run this, this will not work. I have tried print_r($cityList) it returns as ( [0] => ) . might someone send me in the right direction, it would be greatly appreciated.
$querystate = ("SELECT state FROM location_root WHERE country = '$countryfix'") or die("something messed up");
$resultstate = mysql_query($querystate);
while ($rowstate = mysql_fetch_array($resultstate))
{
$categoriesstate[] = $rowstate['state'];
}
$stateArray = array_unique($categoriesstate);
$cityList = ($stateArray) ;
return $cityList;
}
This question is directed towards the query that is for the state drop down. $countryfix = $countryList[$selected country];. print_r($countryfix) works great!It keeps up with every country as selected, although when I run this, this will not work. I have tried print_r($cityList) it returns as ( [0] => ) . might someone send me in the right direction, it would be greatly appreciated.
$querystate = ("SELECT state FROM location_root WHERE country = '$countryfix'") or die("something messed up");
$resultstate = mysql_query($querystate);
while ($rowstate = mysql_fetch_array($resultstate))
{
$categoriesstate[] = $rowstate['state'];
}
$stateArray = array_unique($categoriesstate);
$cityList = ($stateArray) ;
return $cityList;
}