I have used below code. I'm new to PHP and Mysql...
Am I doing something wrong in loop.?
abc table has 70562 records ip2 table has 3833421 records..
Any suggestion for improvement.?
$sql = "SELECT * FROM abc where ip_country IS NULL";
$query = mysqli_query($con, $sql) or die (mysqli_error($con));
while ($row = mysqli_fetch_array($query)) {
$id = $row["subid"];
$ip = $row["ip"];
//Convert Ip to Number
$ipnumberconversion = ip2long($ip);
//Select Ip From Ip Table
$sql2 = "UPDATE abc as a ,
ip2 as b
SET a.ip_state = b.REGION,
a.ip_postalcode = b.ZIPCODE,
a.ip_city = b.CITY,
a.ip_country = b.COUNTRY_NAME
WHERE a.subid = '$id' AND b.IP_FROM <= $ipnumberconversion AND b.IP_TO >= $ipnumberconversion";
$query2 = mysqli_query($con, $sql2) or die (mysqli_error($con));
}