bchandel Posted August 22, 2009 Share Posted August 22, 2009 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 https://forums.phpfreaks.com/topic/171391-what-is-wrong-with-this-code-line/ Share on other sites More sharing options...
PFMaBiSmAd Posted August 22, 2009 Share Posted August 22, 2009 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 https://forums.phpfreaks.com/topic/171391-what-is-wrong-with-this-code-line/#findComment-903951 Share on other sites More sharing options...
Aravinthan Posted August 22, 2009 Share Posted August 22, 2009 If the $Email is not in between <?php ?> you must put it.. Like PFM said, its too hard to know why, as we dont know the context Link to comment https://forums.phpfreaks.com/topic/171391-what-is-wrong-with-this-code-line/#findComment-903954 Share on other sites More sharing options...
bchandel Posted August 22, 2009 Author Share Posted August 22, 2009 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 https://forums.phpfreaks.com/topic/171391-what-is-wrong-with-this-code-line/#findComment-903990 Share on other sites More sharing options...
AngelicS Posted August 22, 2009 Share Posted August 22, 2009 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 https://forums.phpfreaks.com/topic/171391-what-is-wrong-with-this-code-line/#findComment-904011 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.