Though more Php then Contao, Replacing term TYPOlight in DB
We have site as you must have seen long under showcases http://www.web-praesenz.ch.
In whole of the website there are multiple occurance of word 'TYPOlight'. I wanted to have it replaced with word 'Contao', so I thought instead of replacing it one by one, why not per script.
I set to write a script and almost done it with SQL some thing like
Code:
foreach($tables as $table)
{
while($row = mysql_fetch_field($table))
{
$tn = $row->table;
$fn = $row->name;
$sql = "update $tn set $fn= replace($fn,'TYPOlight','Contao')";
mysql_query($sql);
}
}
Yes it replaced every occurance of word 'TYPOlight'. Since many fields are serialized it didn't work well. I even thought for a while and changed the SQL syntex to
Code:
$sql = "update $tn set $fn= replace($fn,'s:9:\"TYPOlight','s:6:\"Contao')";
which didn't work. Any suggestion for a lazy man here.
Re: Though more Php then Contao, Replacing term TYPOlight in
unserialize the data first an loop through the array? Maybe? :)
Or make an sql dump, replace whatever needs to be replaced and import it back afterwards :)
Re: Though more Php then Contao, Replacing term TYPOlight in
Thanks for tips,
Actually my first code worked well. On the places where it fails, which is only few of them (to my luck), i think I'll update it from the backend.
unserialize the data first an loop through the array may be done, but I didn't do it thinking it is a lot of overhead.