This topic is locked

How to search dropdown listbox with more than 30000 records

3/10/2008 2:36:10 PM
PHPRunner General questions
F
Fanta author

Hi everybody.
I have a dropdown listbox which even now has about 2000 peaces of data (it's list of products) and it will bi maybe 15 times bigger, about 30000 products.
As most of you probably know if you press some letter when you are on listbox it will go on the first word in listbox that starts with that letter. This is OK for few records, but not for 30000 of them as much as I expect it will be at the and.
So I need to create my own text field that should help me that I can search this number of records in listbox. After I type a few leters of the word for which I'm interested in the text field and when I click the search button near the text field, it should search all the record's in the listbox and only show in him those results where the letters appear (it could appear at the beginning in the middle or at the and of the word).
Usually this is done in Javascript on client side, but from experience I now that javascript have problems when it comes to more than 15000 records (or at least I have that problem with my code in javascript. If somebody knows or can show me the javascript code which can work this big job with no problem, I will be grateful.)
So I need to create this in PHPRunner with help of PHP. Is there any way to create something like this:
If is nothing written in text field show the all records of the products from the table.

But if I write something in text field and click the search button show me only those records in listbox who have letters in them self which I wrote.
Thank you for all help that I will get in advance.

J
Jane 3/11/2008

Hi,
have you seen Edit box with Ajax popup feature?

http://www.xlinesoft.com/phprunner/docs/aj...lookupaseditbox

F
Fanta author 3/11/2008

Thank you Jane, but this is only part of that what I need.
But my problem can be easily solved if you tell me one thing.
I create in one of the templates my own text field which is empty.
Have can I POST the value from that text field in PHPRunner to page which will work something with that value?
I try to do it in usual way on the page I want to work with sended value, for example on somePage_add.php:
$Value = $_POST['ReceivedValue'];
But it always report me an error.

F
Fanta author 3/12/2008

I'm guessing that something like that it would should be able to do with session or cookie. But I try already a few times to do something like that in PHPRunner and it still doesn't work.
I was able to create example in PHP outside of PhpRunner which is working. I that example I have one textbox and two listbox
When I type some letters in textbox and click the search button it search the first listbox and show in him all the words where this few letters appear.
When I do a double click then with help of javascript, I transfer the selected value from first listbox to second listbox.
When I click the Save button it save me all the values that are in the second listbox.
But how much I try with my basic knowledge of PHP to do the same thing in PHPRunner I always failed.
So far I was able to add textbox on top of dropdown listbox which is created by PHPRunner and second listbox on his right side.
I also was able to transfer with help of Javascript values between two listbox.
Now I only need to took values from textbox or listbox which I created.
So can somebody help and tell me is that possible to do something like that in PHPRunner, to create fields in template and took the values from them, work with them or even compare them with values from database and how it should be done???

F
Fanta author 3/14/2008

This is the last problem which I need to solve. Can somebody please help me. I just need to now how to pass the value from field that I created in the template to the rest of the script.

Sergey Kornilov admin 3/14/2008

I think you can find much better help asking this question in Javascript related newsgroup.
http://www.devx.com/getHelpOn/10MinuteSolution/16372/1954

F
Fanta author 3/17/2008

I have javascript solution, but it has problem after the number of my record pass 15000. I find out in few post around that this is the usually problem with javascript.
Because of that I need to create my own text field which value i need to pass to the query.
The usually way how would I would do that in PHP is:
if (empty($_POST["TextField"]))

{

$result = "SELECT SomeValue FROM MyTable ORDER BY SomeValue ASC";

}
else

{

$result = "SELECT SomeValue FROM MyTable WHERE SomeValue LIKE '%".($_POST["TextField"])."%'";

}
Near the text field I have created button FIND.
The first query is the one that now populate my listbox.
But what I want is that, if the TextField is empty put the values in the listbox from first query as usually, but if i write something in textbox and click FIND button it should execute the second query and put the results in the listbox.
OK, maybe the FIND button is not necessary, something like that could be than OnChange event in text field.
Is there any way that you can help me? Please!!!