* $offset integer the SQL offset (default false)
*/
function limitResult($sql, $limit, $offset=false) {
- return " $sql LIMIT ".((is_numeric($offset) && $offset != 0)?"{$offset},":"")."{$limit} ";
+ if( !is_numeric($limit) ) {
+ wfDie( "Invalid non-numeric limit passed to limitResult()\n" );
+ }
+ return " $sql LIMIT "
+ . ( (is_numeric($offset) && $offset != 0) ? "{$offset}," : "" )
+ . "{$limit} ";
}
function limitResultForUpdate($sql, $num) {
return $this->limitResult($sql, $num, 0);