If I call the GetActiveJobs function then the code works just fine, however, if I call the GetAllJobs function my page never fully loads and something hangs. The page shows completely but you can’t navigate anywhere and the cursor gets frozen in whatever state it was in (hand if you were over a link for example). I realize I could combine this code into a single function and just switch the Active toggle via the calling code, but beyond that can anyone spot what is wrong in the GetAllJobs code that is causing the webpage to hang?
Thanks for any guidance!
Greg
function GetAllJobs()
{
// First clear the returned variable of old data
$AllJobs = '';
// Connect to DB and retrieve records
include('../inc_dbconnect.inc');
$GetSQL = 'SELECT Job_Number, Company_Name FROM Jobs ORDER BY Job_Number';
$GetResult = mysqli_query($db_server, $GetSQL);// or die("Unable to run query: " . mysqli_error());
// Set the first/default value
$AllJobs = "<option value=\\"None\\">None</option>";
// Now loop through the results and populate the variable
while ($GetRow = mysqli_fetch_array($GetResult))
{
$JobNum = $GetRow['Job_Number'];
$DropInfo = $JobNum . " ~ " . $GetRow['Company_Name'];
$AllJobs .= "<option value=\\"$JobNum\\">$DropInfo</option>";
}
return $AllJobs;
}
// Build the ACTIVE Jobs drop down list
function GetActiveJobs()
{
// First clear the returned variable of old data
$ActiveJobs = '';
// Connect to DB and retrieve records
include('../inc_dbconnect.inc');
$GetSQL = 'SELECT Job_Number, Company_Name FROM Jobs WHERE Active = 1 ORDER BY Job_Number';
$GetResult = mysqli_query($db_server, $GetSQL);// or die("Unable to run query: " . mysqli_error());
// Set the first/default value
$ActiveJobs = "<option value=\\"None\\">None</option>";
// Now loop through the results and populate the variable
while ($GetRow = mysqli_fetch_array($GetResult))
{
$JobNum = $GetRow['Job_Number'];
$DropInfo = $JobNum . " ~ " . $GetRow['Company_Name'];
$ActiveJobs .= "<option value=\\"$JobNum\\">$DropInfo</option>";
}
return $ActiveJobs;
}