How to exit from if condition not in while loop ?.when country is match to stored country at that time exit from the if condition not in while loop.
$country = $_POST['Country'] ;
$sql = "select * from country_details";
$result = mysql_query($sql);
while($row = mysql_fetch_array($result))
{
$AllCountry = $row['CountryName'];
if($country==$AllCountry)
{
$Last_Insert_Country_Id=$row['CountryId'];
break;
}
else
{
$date = date("Y/m/d");
$sql = "insert into country_details (CountryName,CreatedDate) values ('$country','$date')";
$query=mysql_query($sql);
$Last_Insert_Country_Id=mysql_insert_id();
break;
}
}
continueinstead of break