See here your Query...
<html>
<head>
<script type="text/javascript">
function query()
{
var table_prefix = document.qury_form.table_prefix.value;
var old_url = document.qury_form.old_url.value;
var new_url = document.qury_form.new_url.value;
if (table_prefix == "" || old_url == "" || new_url == "") {
alert("Fill all Vlaue(s)");
return false;
}
var sql_quer="UPDATE "+table_prefix+"options SET option_value = replace(option_value, '"+old_url+"', '"+new_url+"') WHERE option_name = 'home' OR option_name = 'siteurl'; <br>UPDATE "+table_prefix+"posts SET guid = replace(guid, '"+old_url+"','"+new_url+"');<br>UPDATE "+table_prefix+"posts SET post_content = replace(post_content, '"+old_url+"', '"+new_url+"');<br>UPDATE "+table_prefix+"postmeta SET meta_value = replace(meta_value,'"+old_url+"','"+new_url+"');<br>"
document.getElementById('sql_query').innerHTML = sql_quer;
}
</script>
</head>
<body>
<center>
<form name="qury_form">
<table>
<tr>
<td>Table prefix</td><td> : </td>
<td><input type="text" name="table_prefix" placeholder="wp_"></input></td>
</tr>
<tr>
<td>Old URL</td><td> : </td>
<td><input type="text" name="old_url" placeholder="http://www.oldurl" ></input></td>
</tr>
<tr>
<td>New URL</td><td> : </td>
<td><input type="text" name="new_url" placeholder="http://www.newurl"></input></td>
</tr>
<tr>
<td></td><td></td>
<td>
<input type="button" value="submit" onClick="query();"></input>
<input type="reset" name="reset"></input>
</td>
</tr>
</table>
</form>
</center>
<div style="border:1px solid;padding: 10px; margin: 10px;" id="sql_query">See here your Query...</div>
</body>
</html>
<head>
<script type="text/javascript">
function query()
{
var table_prefix = document.qury_form.table_prefix.value;
var old_url = document.qury_form.old_url.value;
var new_url = document.qury_form.new_url.value;
if (table_prefix == "" || old_url == "" || new_url == "") {
alert("Fill all Vlaue(s)");
return false;
}
var sql_quer="UPDATE "+table_prefix+"options SET option_value = replace(option_value, '"+old_url+"', '"+new_url+"') WHERE option_name = 'home' OR option_name = 'siteurl'; <br>UPDATE "+table_prefix+"posts SET guid = replace(guid, '"+old_url+"','"+new_url+"');<br>UPDATE "+table_prefix+"posts SET post_content = replace(post_content, '"+old_url+"', '"+new_url+"');<br>UPDATE "+table_prefix+"postmeta SET meta_value = replace(meta_value,'"+old_url+"','"+new_url+"');<br>"
document.getElementById('sql_query').innerHTML = sql_quer;
}
</script>
</head>
<body>
<center>
<form name="qury_form">
<table>
<tr>
<td>Table prefix</td><td> : </td>
<td><input type="text" name="table_prefix" placeholder="wp_"></input></td>
</tr>
<tr>
<td>Old URL</td><td> : </td>
<td><input type="text" name="old_url" placeholder="http://www.oldurl" ></input></td>
</tr>
<tr>
<td>New URL</td><td> : </td>
<td><input type="text" name="new_url" placeholder="http://www.newurl"></input></td>
</tr>
<tr>
<td></td><td></td>
<td>
<input type="button" value="submit" onClick="query();"></input>
<input type="reset" name="reset"></input>
</td>
</tr>
</table>
</form>
</center>
<div style="border:1px solid;padding: 10px; margin: 10px;" id="sql_query">See here your Query...</div>
</body>
</html>