alienmojo Posted January 8, 2007 Share Posted January 8, 2007 echo "<a href="editentries.php">$row['address']</a>";Parse error: parse error, unexpected T_STRING, expecting ',' or ';' in C:\Documents and Settings\Marquis Taliaferro\Desktop\web page\listofentries.php on line 40yea my syntax skills with php suck can some one tell me what the problem is Link to comment https://forums.phpfreaks.com/topic/33282-solved-syntax-error/ Share on other sites More sharing options...
hvle Posted January 8, 2007 Share Posted January 8, 2007 you need escape double quote inside string,and wrap array variables with brackets:[code]echo "<a href=\"editentries.php\">{$row['address']}</a>";[/code]this should work Link to comment https://forums.phpfreaks.com/topic/33282-solved-syntax-error/#findComment-155483 Share on other sites More sharing options...
alienmojo Posted January 8, 2007 Author Share Posted January 8, 2007 yes this worked im pretty good at knowing how to do something but getting it to work is another thing Link to comment https://forums.phpfreaks.com/topic/33282-solved-syntax-error/#findComment-155489 Share on other sites More sharing options...
DarkendSoul Posted January 8, 2007 Share Posted January 8, 2007 Remember to mark your posts as solved. :) Link to comment https://forums.phpfreaks.com/topic/33282-solved-syntax-error/#findComment-155491 Share on other sites More sharing options...
alienmojo Posted January 8, 2007 Author Share Posted January 8, 2007 ok i need some more help this is why i didnt make is solvedok this is the code im usingecho "<a href=\"editentries.php?accountnum='.$accountnum.'\">{$row['address']}</a>";when you click on the link this is th addresshttp://24.116.162.98:8080/editentries.php?accountnum='.1.'i need it to look like thishttp://24.116.162.98:8080/editentries.php?accountnum=1 Link to comment https://forums.phpfreaks.com/topic/33282-solved-syntax-error/#findComment-155507 Share on other sites More sharing options...
DarkendSoul Posted January 8, 2007 Share Posted January 8, 2007 Let me explain to you how echoing works.Echo can start with " or ', thought out your whole text if your echo started with this, a second one will close. They are not interchangeable. In this case you started with " so if you wanted to end you had to end with "With this knowledge the proper way would be:echo "<a href=\"editentries.php?accountnum=".$accountnum."\">{$row['address']}[/url]";But you don't even need to end in this case. Alternatively you could use the following with the same resultsecho "<a href=\"editentries.php?accountnum={$accountnum}\">{$row['address']}[/url]";Placing a variable in butterfly brackets is smaller text wise, cleaner and it looks a lot sexier if you ask me.Now when would you use " . . ", well this is best used when you call a function. Functions cannot be called in the text. They will always just be displayed in text.I hope this helps. :) Link to comment https://forums.phpfreaks.com/topic/33282-solved-syntax-error/#findComment-155512 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.