I want a function that will create a JQuery search box based on provide query select strings. It will create a hidden field with the id number associated with the selected value of the search. This id number will be passed and most likely used.
function jquery_search($qs_show, $hidden_name, $pass_var; $main_table, $qs_search=NULL, , $qs_drop = NULL, $style = NULL, $search_name=NULL, $drop_name=NULL) //don't worry about the variables you are not asked to use. They will be implemented later, but we want them in the function for now. Just mark them as null
- puts a search box. It should search the results of $qs_search. It should show in the search box the corresponding results of $qs_show.
when a result is selected, the corresponding $pass_var is put as the value for $hidden_name. If no $pass_var provided, use Primary Key for $main_table.
- if $qs_show is NULL, set it equal to $qs_search
- if $search_name is NULL set search field name to $hidden_name."_search”
- if $style is NULL style and/or class should be name of variable (I don't know exactly which is used by jquery)
- The results of the two queries are connected by the $pass_var. The results of $qs_search are searched, and the results of $qs_show with the same $pass_var are shown.
An Example
$qs_show = "select '( ', [login to view URL], ')', [login to view URL], [login to view URL] from table1 JOIN table2 on [login to view URL] = [login to view URL]"
$hidden_name = "xid"
$pass_var = "[login to view URL]"
$qs_search = "select [login to view URL] as xid, [login to view URL], [login to view URL], [login to view URL], [login to view URL], [login to view URL],[login to view URL], [login to view URL] from table1 JOIN table2 on [login to view URL] = [login to view URL]"
In this situation, the search box would be called "xid_search" and would have the style/class "xid_search". There would be a hidden variable "xid" which would have the class "xid". When the user typed in xid_search, the page would search the results of $qs_search for matching text. But the user would see the corresponding result of $qs_show. So if they typed the first few numbers of a phone number, the function should find every result of $qs_search for any result with that phone number. The user would see the results of $qs_show that had the same xid as the results of qs_search that matched what the user typed. The idea is to be able to search as many possible fields without forcing the user to see all of the results, just the most important information for them to choose who they want. When the user selected the row they want, the value of the hidden variable "xid" would be set to value of xid from the selected row of the query.
Hello,
With 99% completion rate, 650+ successfully completed projects, and a 5.00 reputation (maximum possible, 5.0) (Yes, not even 4.99 !!)... you can never go wrong choosing me :)
I look forward to your reply.
Thanks.
Kind Regards,
Rajesh Soni
More then 7 years of working experience in Telerik Open Access ORM, Entity FrameWork using Code First, Database First Approaches, ASP.NET, Window Service, Web Service, MVC 3.0, MVC 4.0, C#, VB.NET, SQL Server, Access, JQUERY, Fluent/UnObtrusive and JQuery Validation. I have good experience in trouble shooting Front End issues and Performance tuning of Sql Server Database
Good Day. I'm experienced with web technologies. At your service.
I have worked with php, java, html, javascript, css, c and c++, using mvc pattern in some projects. I have more than 3 years of experience working with software development. I have worked with relational databases as well, like MySQL.
Please check my profile, and thanks for your attention.