SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Zealot GHicks's Avatar
    Join Date
    Oct 2003
    Location
    Prescott Valley, Arizona, United States
    Posts
    135
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    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

    PHP Code:
    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;

    Greg Hicks
    Tekamba Computers, LLC
    greg@tekamba.com
    http://tekamba.com

  2. #2
    SitePoint Zealot GHicks's Avatar
    Join Date
    Oct 2003
    Location
    Prescott Valley, Arizona, United States
    Posts
    135
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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.
    Greg Hicks
    Tekamba Computers, LLC
    greg@tekamba.com
    http://tekamba.com

  3. #3
    SitePoint Wizard silver trophybronze trophy Cups's Avatar
    Join Date
    Oct 2006
    Location
    France, deep rural.
    Posts
    6,869
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    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.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •