You are here: Re: char replacement « PHP Programming Language « IT news, forums, messages
Re: char replacement

Posted by Ewoud Dronkert on 11/03/05 11:23

VooDoo wrote:
> How can i do an update on this table to replace only the characters
> 'é' or 'è' by a 'e'.

In PHP:

$subject = 'somé linè';
$search = 'éè';
$replace = 'ee';
$updated = strtr($subject, $search, $replace);

or

$subject = 'somé linè';
$search = array('é', 'è');
$replace = 'e';
$updated = str_replace($search, $replace, $subject);

But I guess you need a SQL query ("table with a field"). Better ask in
comp.databases.mysql or have a look at
http://dev.mysql.com/doc/refman/4.1/en/string-functions.html It might be

UPDATE t1 set f1 = REPLACE(REPLACE(f1, 'è', 'e'), 'é', 'e')

--
E. Dronkert

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация