SN1P3R_85 Posted September 9, 2008 Share Posted September 9, 2008 Hi, i want to echo a table, and in the table, i have links to certain pages. Each page name is stored in an sql database. I tried to write it, but i keep getting syntax errors. This is what i have: echo "<table class=\"forum\" border=\"1\" width=\"40%\"><tr style=\"height:20px\"><td class=\"forum\" width=\"50%\"><a href=\"/forum/" . $row['Thread_name'] . "_" . $row['Id'] . ".php\">$row['Thread_name']</a></td></tr>"; p.s. - i end the table somewhere else, so don't worry about that. Link to comment https://forums.phpfreaks.com/topic/123533-php-echo-mysql-syntax-help/ Share on other sites More sharing options...
The Little Guy Posted September 9, 2008 Share Posted September 9, 2008 Try this: echo '<table class="forum" border="1" width="40%"><tr style="height:20px"><td class="forum" width="50%"><a href="/forum/'. $row['Thread_name'] .'_'. $row['Id'] .'.php">'.$row['Thread_name'].'[/url]</td></tr>'; Link to comment https://forums.phpfreaks.com/topic/123533-php-echo-mysql-syntax-help/#findComment-637995 Share on other sites More sharing options...
SN1P3R_85 Posted September 9, 2008 Author Share Posted September 9, 2008 It works, could you tell me what you changed, and why mine wasn't working? Link to comment https://forums.phpfreaks.com/topic/123533-php-echo-mysql-syntax-help/#findComment-637996 Share on other sites More sharing options...
The Little Guy Posted September 9, 2008 Share Posted September 9, 2008 Instead of having the outer echo be a double quote I did a single quote and removed all of the \" If your going to place HTML inside of an echo, the best way would be to use a single quote in my opinion, not a double quote. It makes for less errors. Link to comment https://forums.phpfreaks.com/topic/123533-php-echo-mysql-syntax-help/#findComment-638001 Share on other sites More sharing options...
SN1P3R_85 Posted September 9, 2008 Author Share Posted September 9, 2008 Thanks alot for the help, cleared up alot of my problems. Link to comment https://forums.phpfreaks.com/topic/123533-php-echo-mysql-syntax-help/#findComment-638003 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.