DB_Pager throws warning is you type in out-of-range number in URL

From: Date: Mon, 03 Oct 2005 19:05:37 +0000
Subject: DB_Pager throws warning is you type in out-of-range number in URL
Groups: php.pear.general 
Request: Send a blank email to pear-general+get-21210@lists.php.net to get a copy of this message
Fairly standard paging code: $from = $_GET['from']; // not included is integer checking $limit = 10; $maxpages = 10; $nrows = $db->getRow("<sql code here"); $data = DB_Pager::getData($from, $limit, $nrows[0], $maxpages); $sql_CODE = "<sql code here"; $res = $db->limitQuery($sql_CODE, $from, $limit); If there is only one page of data and you enter a "4" in the URL for parameter "from=4",, you get the following: "Warning: Cannot use a scalar value as an array in ... on line 84" Line 84 is: foreach ($data['pages'] as $page => $start_row) { I want to make this robust so what checking do I need to do to avoid that error? Thanks. __________________________________ Yahoo! Mail - PC Magazine Editors' Choice 2005 http://mail.yahoo.com

« previous php.pear.general (#21210) next »