这是我的问题,我有一个 ISO-8859-1 的数据库,我的网页是 UTF-8,我想从我的查询中删除重音我能够找到没有重音的名字,但如果他们有他们我'我找不到他们(在下面我有一个带口音的名字,我找不到名字)求救,我快死了……我有这个:
$el=array(); //<----------------------------------------------------vowels to remove
$el[]=iconv('UTF-8','ISO-8859-1','á');
$el[]=iconv('UTF-8','ISO-8859-1','é');
$el[]=iconv('UTF-8','ISO-8859-1','í');
$el[]=iconv('UTF-8','ISO-8859-1','ó');
$el[]=iconv('UTF-8','ISO-8859-1','ú');
$string='Francisco Gutiérrez'; //<----------------------------------------target
$string=strtolower($string); ///<----------------------------------string to iso
$string=iconv('UTF-8','ISO-8859-1',
$string);
$tem3="SELECT nom||' '||app||' '||apm as NAME
FROM STUDENTS
where
(
upper(
replace(
replace(
replace(
replace(
replace(
lower(NAME),'".$el[0]."','a'),
'".$el[1]."','e'),
'".$el[2]."','i'),
'".$el[3]."','o'),
'".$el[4]."','u')
)
like '%'||
upper(
replace(
replace(
replace(
replace(
replace(
'".$string."','".$el[0]."','a'),
'".$el[1]."','e'),
'".$el[2]."','i'),
'".$el[3]."','o'),
'".$el[4]."','u')
)||'%'
)";