mysql - Speed up PHP rendering HUGE select list -
you guys have been awesome.
my script goes , selects 8500 customers mysql, in mysql workbench, takes 0.16 seconds, fine, takes browser 10 seconds render box results.
is there faster way create huge select box?
i'm stumped because thought php made on server side , cannot sped up.
<body> <select name="customer" id="customer" onchange="getcustinfo();" data-placeholder="choose customer" class="chosen-select" style="width:500px;" tabindex="1"> <option value=""></option> <?php // products $sql = " select * `cust` left join `address` on `cust`.`custid` = `address`.`addcustid` , `address`.`addtype` = 'b' `cust`.`custactive` = 'y'" ; $result = mysqli_query($con,$sql) or die('query failed: not list of clients: ' . mysqli_error($con)); // query while ($row = mysqli_fetch_array($result)) { foreach ($row $key => $value){ ${$key} = $value; } $space=""; $endingspaces = 4-(2*strlen($prodid)); $custname = substr($row['custname'],0,15); $address1 = substr($row['address1'],0,15); $addcity = substr($row['addcity'],0,15); print "<option value=\"$custid\">$custid: $space$custname, $address1, $addcity, $addstate</option>"; } ?> </select> </body>
cache it. generate html once , save in memory if can (apc, memcache) or flat file. on subsequent page loads read in cache , echo out. much faster.
Comments
Post a Comment