Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Chained Select Menus

Options
  • 30-01-2005 5:09pm
    #1
    Registered Users Posts: 884 ✭✭✭


    Hi there,

    Just wonder can something like this can be done in Php ??

    I just need to know if it can be done, to filter a search on a database. I will learn how to do it in a while, just need to know if it can first !!


Comments

  • Closed Accounts Posts: 17,208 ✭✭✭✭aidan_walsh


    Thats something that needs to be done by Javascript. All PHP processing takes place on the server side, so unless you are going to send the data back, and reprocess it sending back the page this time with the corrected menus, you'll need a Javascript to handle it.


  • Registered Users Posts: 884 ✭✭✭Cork Skate


    Is there any means of filtering a search on a Php page before it goes to the server and tries to get the data results from the database.

    I just want to avoid have to search through 1000s of records so i'm trying ot minimise that search !!


  • Registered Users Posts: 884 ✭✭✭Cork Skate


    Am i approaching this the wrong way ??

    I am not familiar with Php i'll admit, but what i am trying to do is avoid lots of work on the server side, which hopefully would result in a faster search (am i right in thinking that??)

    The purpose of the drop down menus was to filter the search as much as possible, so the SQL query would do all the work when consulting that database of records.

    As i said ... i'm all new to this .... is that the right way that i'd tackle it ??


  • Banned (with Prison Access) Posts: 16,659 ✭✭✭✭dahamsta


    What DS is trying to explain is that the page you linked is prepopulated with ALL of the data, which is programatically selected on the client side using javascript. So it has little or no bearing on queries - it just has one, which gets everything.

    You can do it the way you're suggesting, but it would require a request to the server every time you changed a select, which can be frustrating for the user. An alternative would be XMLHTTP, but that might be outside your ability atm (no offense).

    adam


  • Registered Users Posts: 32,136 ✭✭✭✭is_that_so


    Cork Skate wrote:
    Am i approaching this the wrong way ??

    I am not familiar with Php i'll admit, but what i am trying to do is avoid lots of work on the server side, which hopefully would result in a faster search (am i right in thinking that??)

    The purpose of the drop down menus was to filter the search as much as possible, so the SQL query would do all the work when consulting that database of records.

    As i said ... i'm all new to this .... is that the right way that i'd tackle it ??

    The client is really just there to display output. Servers are designed to do the grunt work and cope with heavy loads.


    Two things here

    - Make sure you get your database design right i.e. Make sure the tables are what you want. Bad design can bugger up any application.

    - Filter on the server side - through the SQL query, SQL queries are fairly fast unless you want to use a huge number of multiple joins in it.

    You don't have to use PHP, for example Perl DBI can process the query as well. You can use any server side scripting.

    To do what you want to do , just output it into an array and then do the javascript population of the menus.

    As a general comment if you are returning 1,000s of records for a simple query then the query/DB table is probably badly designed.


  • Advertisement
Advertisement