Error " . mysql_errno() . ": " . mysql_error() . ""); } else if (mysql_num_rows($res) == 0) { echo("Query executed successfully"); } else { while (($r_array = mysql_fetch_row($res))) { $reptxt .= "UPDATE itblog.wps_posts SET ID=" . $r_array[1] . ", guid=replace(guid,'" . $r_array[4] . "','" . str_replace("/wordpress/", "/ITblog/", $r_array[5]) . "') WHERE ID=" . $r_array[0] . " and post_title='" . $r_array[2] . "' and '" . $sdate . "'='" . $sdate . "'\n"; mysql_query("UPDATE itblog.wps_posts SET ID=" . $r_array[1] . ", guid=replace(guid,'" . $r_array[4] . "','" . str_replace("/wordpress/", "/ITblog/", $r_array[5]) . "') WHERE ID=" . $r_array[0] . " and post_title='" . $r_array[2] . "'"); } } if ($reptxt != "") { file_put_contents("old_new_wp_mismatch_id.txt", $reptxt); } mysql_close($link); ?>