Jump to content

Create a URL that executes a MySQL query


snorky

Recommended Posts

I want to create a link to a web page that will automatically execute the query that the user would do, if the user had to. I know it's done all the time, but I can't remember which sites use this technique. If I  could find one, I would copy the techniques.

 

To do the query now, the user accesses the main page for database access, and sees a list of criteria to perform the search. From there the user selects a few criteria, and then my PHP creates and executes the query that gives the user the desired results.

 

For example, to view certain fields in table "phonelist1" where the the results only show names and phone numbers of all people located in building "BVE", the user

  • goes to the "Select Criteria" page
  • checks the box for Building BVE
  • clicks the "Ask" button

That creates the following query:

 

select fname,lname,phone from phonelist1 where bldg="BVE";

 

That query displays a page that  shows the results of the query: a table where the

  • columns are fname,lname,phone
  • rows are records of fname, lname, and phone

 

I want to create a link that executes that query through the address bar on the browser. That way I don't require the user to make choices that would result in the above query. Remember: I have the databases and php working well. I just want to make the process easier for the end user.

 

I've seen it in action. the URL looks something like

 

http://www.mydomain.com/home.php?bldg="bve"

 

home.php already has all the the php and sql, and is waiting for someone to ask...

 

As always, the devil is in the details, and I can't remember all of the details.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.