First of all, your Elseif here doesnt have a condition, you should just use ELSE...you never initialize the session using Session_start() at the top of the page, I dont think it ever sees the session as being registered (as it is) without this...so every time, the query is reset....
if($_SESSION['sql']!=""){
$sql = $_SESSION['sql'];
} elseif {
/* Iterate through variables and build code on the fly */
$sql = "SELECT jobid, date, title, description, location, skills, industry, contactid FROM job WHERE";
$sql_where = "";
Also, unless im wrong here, the point at which $sql and $sql_where get joined, there is no space in between WHERE and AND...
$sql = "SELECT jobid, date, title, description, location, skills, industry, contactid FROM job WHERE";
$sql_where = "";
if($title!= "") {
if($sql_where != "") {
$sql_where = $sql_where . "AND ";
}
$sql_where = $sql_where . " title = '" . $title . "' ";
}
Just for simplicity, why not make all of the statements like this
$sql = $sql.$sql_where;
Look like this
$sql .= $sql_where;
You initialize $page as a string or char when you use the single quotes, just use a #, especially when you perform arithmatic later...
// if no value for page, page = 1
if ($page==''){
$page='1';
}
// create a start value
$start = ($page-1) * $pagelimit;
Instead of using a while loop here, you might consider a foreach loop to iterate through the results array
while ($row = mysql_fetch_array($sql_result)){
$jobid = $row["jobid"];
$date= $row["date"];
$title = $row["title"];
$desc = $row["description"];
$location = $row["location"];
$salary = $row["salary"];
$industry = $row["industry"];
Also, and im not exactly sure on this, but you register your session, and aside from overwriting the varible right away, you also dont have a call to the function session_start() which is required for the session vars to work right.
One last thing, I see a first SQL query, and a second one (labeled as the third one) but no query labeled as the second query...
I hope one or more of these things helps you