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!

echo line 1

Status
Not open for further replies.

manicleek

Technical User
Joined
Jun 16, 2004
Messages
143
Location
GB
Whever I try and run a page I get the error message


Parse error: parse error, unexpected T_STRING, expecting ',' or ';' in C:\Documents and Settings\newuser\My Documents\My Webs\php - marinas\index_copy.php on line 344


The line in question currently looks like:


echo "<a href="udetails.php?marina=$latestmarina">$latestname</a> - $latestcountry<br>";


have tried messing around with it in several ways can anyone tell me what is missing to make it work
 
Try:
Code:
echo "<a href=\"udetails.php?marina=$latestmarina\">$latestname</a> - $latestcountry<br>";

Or this should work too:
Code:
echo '<a href="udetails.php?marina=$latestmarina">$latestname</a> - $latestcountry<br>';


You have to escape any quoatation mark you use as a delimiter in a string.


___________________________________
[morse]--... ...--[/morse], Eric.
 
Won't the second example result in not-parsing the variables but rather just printing them out? Second example should look like this:
Code:
echo '<a href="udetails.php?marina=' . $latestmarina . '">' . $latestname . '</a> -' . $latestcountry . '<br />';
 
Thanks for that

The first code worked properly, the second one worked but just printed $marinaname etc in the sentence rather than the contents of that variable
 
thats right......concatenate using dots.

___________________________________
[morse]--... ...--[/morse], Eric.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top