I have a variable ($city) that pass through from other page and would like to select out from my database. However, I would only allow either one of the mysql_query to be selected when either of the condition is met but for my case it only work for the second condition. I apologize that I am lack of experience in php but would appreciate if anyone can assist here. thanks.
$allcity = "AllCity";
if (($city) == ($allcity))
{
$sql = mysql_query("SELECT * FROM upload WHERE allcity = '$city'");
}
else
{
$sql = mysql_query("SELECT * FROM upload WHERE city = '$city'");
}
while ($row = mysql_fetch_array($sql))
{
echo $id = $row['id'];
echo $lat = $row['lati'];
echo $long = $row['longi'];
echo $name = $row['name'];
echo $country = $row['country'];
echo $city = $row['city'];
echo $price = $row['price'];
}