Vote count:
0
I'm trying to create a mysql query which will select soundex equivalent surnames from a data base. In php I've produced the soundex code by:
$sxname = soundex($name);
and then I built the mysql query
$query = "SELECT *
FROM database
WHERE soundex(surname)
LIKE '$sxname'"
;
This works fine for a lot of surnames, but not for others - such as CAWS. The php soundex value for CAWS is C200 but the mysql value comes out as C000.
Is there a solution to these differences ?
I did try to use a function so both were created in php:
function mysql_soundex($name)
{
$snname = soundex($name);
return $snname;}
and call it up in:
$query = "SELECT *
FROM database
WHERE mysql_soundex('surname')
LIKE '$sxname'"
;
But that didn't work either.
asked 1 min ago
Aucun commentaire:
Enregistrer un commentaire