Error " . mysql_errno() . ": " . mysql_error() . ""); } else if (mysql_num_rows($res) == 0) { echo("Query executed successfully"); } else { if (($r_array = mysql_fetch_row($res))) { $bigval = $r_array[0]; $bigval++; mysql_select_db($dbname); $res = mysql_query("SELECT MAX(ID) FROM rjmprogr_wordpress.wp_posts"); if ($res == 0) { echo("Error " . mysql_errno() . ": " . mysql_error() . ""); } else if (mysql_num_rows($res) == 0) { echo("Query executed successfully"); } else { if (($r_array = mysql_fetch_row($res))) { if ($r_array[0] >= $bigval) { $bigval = $r_array[0]; $bigval++; } } } } } } mysql_select_db($dbname); $res = mysql_query("SELECT t1.ID, t2.ID, t1.post_title, t2.post_title, substr(t1.guid, instr(t1.guid, '/ITblog/')) as t1g, substr(t2.guid, instr(t2.guid, '/wordpress/')) as t2g FROM itblog.wps_posts t1 JOIN rjmprogr_wordpress.wp_posts t2 ON t2.post_title = t1.post_title and t2.post_status in ('publish','future') and t1.post_status in ('publish','future') WHERE t2.ID != t1.ID"); if ($res == 0) { echo("Error " . mysql_errno() . ": " . mysql_error() . ""); } else if (mysql_num_rows($res) == 0) { echo("Query executed successfully"); } else { while (($r_array = mysql_fetch_row($res))) { if ($goes == 1) { $reptxt .= "UPDATE rjmprogr_wordpress.wp_posts SET ID=" . $r_array[0] . ", guid=replace(guid,'" . $r_array[5] . "','" . str_replace("/ITblog/", "/wordpress/", $r_array[4]) . "') WHERE ID=" . $r_array[1] . " and post_title='" . $r_array[2] . "' and '" . $sdate . "'='" . $sdate . "'\n"; mysql_query("UPDATE rjmprogr_wordpress.wp_posts SET ID=" . $r_array[0] . ", guid=replace(guid,'" . $r_array[5] . "','" . str_replace("/ITblog/", "/wordpress/", $r_array[4]) . "') WHERE ID=" . $r_array[1] . " and post_title='" . $r_array[2] . "'"); } else { mysql_select_db($dbname); $reptxt .= "UPDATE rjmprogr_wordpress.wp_posts SET ID=" . $bigval . ", guid=replace(guid,'=" . $r_array[1] . "','=" . $bigval . "') WHERE ID=" . $r_array[1] . " and post_title='" . $r_array[2] . "' and '" . $sdate . "'='" . $sdate . "'\n"; mysql_query("UPDATE rjmprogr_wordpress.wp_posts SET ID=" . $bigval . ", guid=replace(guid,'=" . $r_array[1] . "','=" . $bigval . "') WHERE ID=" . $r_array[1] . " and post_title='" . $r_array[2] . "'"); mysql_select_db($dbaltname); $reptxt .= "UPDATE itblog.wps_posts SET ID=" . $bigval . ", guid=replace(guid,'=" . $r_array[0] . "','=" . $bigval . "') WHERE ID=" . $r_array[0] . " and post_title='" . $r_array[2] . "' and '" . $sdate . "'='" . $sdate . "'\n"; mysql_query("UPDATE itblog.wps_posts SET ID=" . $bigval . ", guid=replace(guid,'=" . $r_array[0] . "','=" . $bigval . "') WHERE ID=" . $r_array[0] . " and post_title='" . $r_array[2] . "'"); $bigval++; } } } if ($reptxt != "") { file_put_contents("old_new_wp_mismatch_id.txt", $reptxt); } } mysql_close($link); ?>