From 2fd1a44842fc86a813884937ffcd9f5fdd6769e8 Mon Sep 17 00:00:00 2001 From: markjcrane Date: Tue, 19 Apr 2016 14:05:12 -0600 Subject: [PATCH] voicemail_id is not guaranteed to be numeric so can't use the cast unless we protect against non numeric ids. --- app/voicemails/voicemails.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/voicemails/voicemails.php b/app/voicemails/voicemails.php index 8a52b77eec..a420938e17 100644 --- a/app/voicemails/voicemails.php +++ b/app/voicemails/voicemails.php @@ -116,10 +116,10 @@ else { //get the list $sql = str_replace('count(*) as num_rows', '*', $sql); if (strlen($order_by) > 0) { - $sql .= ($order_by == 'voicemail_id') ? "order by cast(voicemail_id as int) ".$order." " : "order by ".$order_by." ".$order." "; + $sql .= ($order_by == 'voicemail_id') ? "order by voicemail_id ".$order." " : "order by ".$order_by." ".$order." "; } else { - $sql .= "order by cast(voicemail_id as int) asc "; + $sql .= "order by voicemail_id asc "; } $sql .= "limit ".$rows_per_page." offset ".$offset." "; $prep_statement = $db->prepare(check_sql($sql));