Jump to content

combobox with large amount of data


guidonts

Recommended Posts

Hello everyone

 

I'm trying to fill in a combobox with a large amount of data (from a table containing about 100 000 names of patients).

 

I can fill the box but it takes about 20 seconds before I can see the first items.

 

Is there a way to do it very fast?

 

I was using Micrsoft Access and there it is no problem to see all the names at once.

 

Thank you very much.

 

Guido

Link to comment
Share on other sites

I'm not using javascript, because I don't know how to do it.

 

this is the code I use

 

$sql="SELECT * FROM Patienten WHERE PATNR LIKE '$my_data%'";
$result = mysqli_query($conn,$sql) or die(mysqli_error());
if($result)
{
while($row=mysqli_fetch_array($result))
{
$naam=STR_PAD($row['PATNAAM'],20,".",STR_PAD_RIGHT);
$voornaam=STR_PAD($row['PATVNAAM'],20,".",STR_PAD_RIGHT);
echo $row['PATNR']."....".$naam.$voornaam."n";
$_SESSION["NAAM"]=$naam;
$_SESSION["PATNR"]=$row['PATNR'];
}
}
$my_data = the input in the field
Edited by guidonts
Link to comment
Share on other sites

I have changed it to an input field with this code

 

this is the input field:

 

<input name="tag" type="text" id="tag" size="60"/>

 

 

this is the script

 

 

<script>
$(document).ready(function(){
$("#tag").autocomplete("autocomplete.php", {
selectFirst: true
});
});
</script>
the autocomplete;php :
$q=$_GET['q'];
$my_data=mysqli_real_escape_string($conn,$q);
//$mysqli=mysqli_connect('localhost','root','','autofield') or die("Database Error");
$sql="SELECT * FROM Patienten WHERE PATNR LIKE '$my_data%'";
$result = mysqli_query($conn,$sql) or die(mysqli_error());
if($result)
{
while($row=mysqli_fetch_array($result))
{
$naam=STR_PAD($row['PATNAAM'],20,".",STR_PAD_RIGHT);
$voornaam=STR_PAD($row['PATVNAAM'],20,".",STR_PAD_RIGHT);
echo $row['PATNR']."....".$naam.$voornaam."n";
$_SESSION["NAAM"]=$naam;
$_SESSION["PATNR"]=$row['PATNR'];
}
}
?>
this fills my inputfield in about 15 seconds; but it is still too slow
Guido
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...