Quote:
Originally posted by Due
This might be what you are looking for:
$searching="FIND-THIS";
$replace="REPLACE-WITH-THIS";
$res = mysql_query("SELECT * FROM jg_galleries WHERE url LIKE '%$searching%'");
while($row = mysql_fetch_array($res)) {
$surl++;
$my_id[$surl] = $row[id];
$my_thumb[$surl] = $row[url];
}
while($y<$surl){
$y++;
$newurl[$y]=str_replace("$searching", "$replace", $my_thumb[$y]);
$query = mysql_query("UPDATE jg_galleries SET url='$newurl[$y]' WHERE id='$my_id[$y]'") or print mysql_error();
}
|
there is NO reason at all to do this, when a simple
"UPDATE x SET y WHERE z" query will do just as well...