I have a mysql database that contains cities, countries, timezones and latitude and longitude fields. I am trying to find the timezone for specific cities by using their latitude and longitute coordinates but I am bringing up inaccurate results. I know my php query is inaccurate and that there is a formula that is needed to do this correctly. Hoping somone might have some experience with this and can help. Thank you in advance.
This is inaccurate, but you can see what I am trying to do.
$result = mysql_query("select time_zone from timezones where latitude = '$latitude' and longitude ='$longitude' limit 0,1");
while ($row = mysql_fetch_array($result)){
$time_zone = $img_info['time_zone'];
}