Page hangs during function call

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;
}

OK, disregard, I guess it is just due to the amount of data being returned by the non-limited request. I’ll have to rethink that and discuss with the client as to whether they truly need all jobs returned in this list or simply the active ones. Might be better to build an all jobs list into a static file that gets updated whenever a new job is created rather than in it’s current function of every time the main nav page loads.

Nods, yep cache it.

Still, even then it sounds like a usability nightmare, a drop list that must contain so many options it times out!

Probably needs an ajaxian-style autocomplete, say after 3 first letters have been typed.

This looks like one of those tasks where you really need a real end user to show you exactly how they would use this tool in real life. How they filter and sift so many options in their heads will be unlikely to match your modelling of their processes.

This is the most annoying thing I find about most kinds of contract work, eliminating the levels of bureaucracy between you and the real end user merely in order to create something useful and usable.