Is it possible to make an str_replace default on every record? As it is now I have to make the code below everytime I get something from my db: $sql = $db->sql_query("SELECT * FROM ".$prefix."_links WHERE uid=$userid AND catid=$catid ORDER BY name"); while ($row = $db->sql_fetchrow($sql)) { $name = $row['name']; $change = array("æ", "ø", "Ã¥", "Æ", "Ø", "Ã…"); $change_to = arraa("æ", "ø", "å", "Æ", "Ø", "Å"); $name = str_replace($change, $change_to, $name); } PHP: How can I set this as default for every record, mayby in my config file?!?
Do something like: while ($row = $db->sql_fetchrow($sql)) { $name = change_it($row['name']); } function change_it($name){ $change = array ("æ", "ø", "Ã¥", "Æ", "Ø", "Ã…"); $change_to = arraa("æ", "ø", "å", "Æ", "Ø", "Å"); $name = str_replace($change, $change_to, $name); return $name; } Put that function code in some config/function file. regards
Arh... But I want a solution that makes the str_replace nomatter what the table is and nomatter what the field is... If ever I select something and it has a"æøåÆØÅ in it it should be replaced.