Jump to content

What is wrong with this code line?


bchandel

Recommended Posts

What is wrong with this code line? Your help is appreciated.

 

Email:<a href="mailto {['$Email']}"<Email></a>

 

Getting following error message:

 

Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /home/public_html/try.php on line 28

 

 

 

Link to comment
Share on other sites

Taken out of context of where that is being used it is hard to tell (please post the whole php statement that code is part of), but I'll guess your overall string is using double-quotes to delimit it and the part you actually posted contains some un-escaped double-quotes so the overall syntax of the string was broken when the double-quotes were encountered.

Link to comment
Share on other sites

Here is the complete code. Wants to make E-mail and Web clickable hyperlinks. Thank you!

 

<html>

<body>

<?php

$db_connect = mysql_connect("xxxx.com", "xxxx_user", "password");

mysql_select_db("xxxxx_database");

$query="SELECT * FROM Directory";

$result=mysql_query($query);

$num=mysql_numrows($result);

mysql_close();

 

print "<h1><center>Chandel's Directory</center></h1><br>";

$i=0;

while ($i < $num) {

 

$Name=mysql_result($result,$i,"Name");

$LastName=mysql_result($result,$i,"LastName");

$FirstName=mysql_result($result,$i,"FirstName");

$Phone=mysql_result($result,$i,"Phone");

$Mobile=mysql_result($result,$i,"Mobile");

$Email=mysql_result($result,$i,"Email");

$Web=mysql_result($result,$i,"Web");

$State=mysql_result($result,$i,"State");

$Country=mysql_result($result,$i,"Country");

echo "<b>$Name</b><br>FirstName: $FirstName<br>

Home Phone: $Phone<br>

Mobile: $Mobile<br>

 

Email:<a href="mailto {['$Email']}"<Email></a><br>

 

Web Site: $Web<br>

State: $State<br>

Country:$Country<br><hr><br>";

 

$i++;

}

 

?>

</body>

</head>

Link to comment
Share on other sites

I think this is your solution:

 

Email:<a href=\"mailto {['$Email']}\"><$Email></a><br>

 

 

 

You have to use backslashes inside the href, (or you can also use a single quote mark -> ' ), or else you will close the "echo".

 

Note: The backslash is being removed, but you must use a backslash before both Quotation marks -> "

 

By the way, please use code tags, since it will make it much easier to read, thanks =)

 

Best wishes

//AngelicS

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.