Re: Looking for the code to make a form for a database search, please help.

From: Date: Thu, 08 May 2003 23:51:35 +0000
Subject: Re: Looking for the code to make a form for a database search, please help.
Groups: php.windows 
Request: Send a blank email to php-windows+get-19818@lists.php.net to get a copy of this message
Hi Doug, If I'm reading this right, you want to enable users to generate a custom query for your database. The simplest way I achieve that is: Supply a bunch of drop-down lists (HTML select tags) with the field names as the values and a friendly name as inner text, of the fields you want users to be able to query on, with a text box next to it. Supply as many of these pairs as the number of criteria you want the user to be able to query on. Parse the value - user input pairs to a usable sql string either in javascript or php, depending on your target browser platform. (I'm fortunate - I only have to target MS IE 5.5 and above, so I can use all sorts of tricks that can't be used with multi-browser targets) If your target allows you to use javascript you can vet user input at the client-side and get the user to correct any rubbish before it goes to the server. Once you have the sql string pass it to your database and display the returned info either on the same page as the criteria selection, a new page or a pop-up window. I know there is a lot of work needed to flesh out this skeleton, but that's pretty much the model I use, in a nutshell, for some high-octane intranet database apps. for my employers.Hope the above ramblings help, Cheers, Jennifer Acorn Tutors <info@acorntutors.com> wrote:Hi everyone, I have a database and I would like people to be able to query it. My aim is to have them fill in boxes (on a form is what Im thinking) and the values they put in the form are passed as variables to a database query to return what they want from the database (much like a search engine I guess). Can anyone help, perhaps point me to a web site that features this kind of code? Help appreciated, Doug -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --------------------------------- Yahoo! Mobile - Check & compose your email via SMS on your Telstra or Vodafone mobile. --------------------------------- Yahoo! Mobile - Check & compose your email via SMS on your Telstra or Vodafone mobile.

« previous php.windows (#19818) next »