From: Stéphane Jacob Date: Sun, 2 Oct 2011 21:57:36 +0000 (+0200) Subject: Chose longest matching phone prefix. X-Git-Tag: xorg/1.1.4~103 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=f7608ea5a67d0a98e926d3bd169fe2c0144c388f;p=platal.git Chose longest matching phone prefix. Signed-off-by: Stéphane Jacob --- diff --git a/classes/phone.php b/classes/phone.php index c709281..8356f64 100644 --- a/classes/phone.php +++ b/classes/phone.php @@ -188,6 +188,7 @@ class Phone $res = XDB::query('SELECT phonePrefix AS phoneprf, phoneFormat AS format FROM geoloc_countries WHERE phonePrefix = {?} OR phonePrefix = {?} OR phonePrefix = {?} + ORDER BY phonePrefix DESC LIMIT 1', substr($tel, 0, 1), substr($tel, 0, 2), substr($tel, 0, 3)); if ($res->numRows() == 0) {