From f7608ea5a67d0a98e926d3bd169fe2c0144c388f Mon Sep 17 00:00:00 2001 From: =?utf8?q?St=C3=A9phane=20Jacob?= Date: Sun, 2 Oct 2011 23:57:36 +0200 Subject: [PATCH] Chose longest matching phone prefix. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Stéphane Jacob --- classes/phone.php | 1 + 1 file changed, 1 insertion(+) 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) { -- 2.1.4