Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

URL Parameter

Status
Not open for further replies.

GeoDM

Technical User
Dec 16, 2003
66
US
Im new to PHP and am trying to edit some code for a friend to get a URL Parameter to work properly. So first I want to know if what he wants to do is possible.

Basically he want to select a record by two parameters. 1) a ID and 2) a hospital. Right now it selects by ID but due to bad database design ID is not unique so therefore it does not return the correct results. I have noticed that ID and Hospital show up correctly and works in the URL seperately but will not select a record together. So what would the format look like if thats possible. If the code is right would it endup something like
/?id=401&hospital=78
 
OK, you are passing two parameters; you now need to use them within your query:
Code:
$sql = 'SELECT * FROM my_table WHERE `table_id` = "'.$_REQUEST['id'].'" AND `table_hospital` = "'.$_REQUEST['hospital'].'" LIMIT 1;';




--
SouthBeach
The good thing about not knowing is the opportunity to learn - Yours truly, 2008.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top