I'm just trying to finish off some code - hence my third post this evening!
Anyhow I have a script which is returning paged recordsets, the script uses 3 SQL queries:
1 - Gathers the results
2 - Limits the results gathered and displaying relevant to the page limit specified
3 - Finally displays the information
My problem is that at the moment my 2nd SQL query is not limiting the results and showing 1 result per page - instead all the results are shown on one page.
Originally when the SQL Query was hardcoded it looked like this:
$strSQL = mysql_query("SELECT * FROM job LIMIT $start,$pagelimit");
Since then I have incorporated some code to create the SQL on the fly, thus keeping the SQL in a variable $sql rather than it being hardcoded.
I have created the following code:
$limit_sql = "LIMIT ".$start.",".$pagelimit;
$applied_sql = $sql.$limit_sql;
If I print the code it looks like this:
SELECT jobid, date, title, description, location, skills, industry, contactid FROM job WHERE location = 'halifax' LIMIT 0,1
The code that finally runs the query is this:
$sql_result = mysql_query($applied_sql) or die('SQL Error - died at SQL Query2');
Any ideas why the code is failing to apply a limit to the results?