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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

passing url parameters 1

Status
Not open for further replies.

manicleek

Technical User
Joined
Jun 16, 2004
Messages
143
Location
GB
I am trying to pass a url parameter, the url looks like this:


I have tried using

$detailsquery = "SELECT * FROM marinas WHERE marina=$_GET['marina']";

to get the details but this came up with the error

Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in udetails.php on line 9

Should I be using something else in my sql?
 
PHP doesn't like referencing arrays inside double quotes. Just move the $_GET array out of the quotes and it should work.
Code:
$detailsquery = "SELECT * FROM marinas WHERE marina=" . $_GET['marina'];
Hope this helps.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top