I'm currently working on a pagination system and have run into some problems. I'm using "LIMIT" to determine which results should be displayed. It's working fine on one query but not another.
Firs here is the code I'm using to create the limit portion of the string:
Next I apply it like so to the first query (which works great):
$max = 'limit ' .($pagenum - 1) * $page_rows .',' .$page_rows;
Then I try to apply that same logic to a similar query in another piece of code and I keep getting an error. Here's the query statement:
$sql = "SELECT id, first_name, last_name, department, phone FROM staff_dir $max";
Am I just not constructing this properly?
$sql = 'SELECT id, first_name, last_name, department, phone FROM staff_dir WHERE department LIKE "'.$_SESSION['submittedDepartment'].'%" $max';