Aureole Posted July 24, 2007 Share Posted July 24, 2007 echo "<a href=\"http://www.veraci7y.net/news/read.php?id=$row['id'];\" target=\"_blank\" title=\"Read full story...\" class=\"newstitle\">$row['title'];</a><p class=\"newsinfo\">Posted by <a href=\"http://www.veraci7y.net/forums/index.php?showuser=$row['authorid'];\" class=\"user\" title=\"View Member\'s Profile\">$row['author'];</a> <span class=\"newsdate\">$row['prettydate'];</span></p><p class=\"newscontent\">$row['short'];</p>"; I thought that would work but it didn't. I tried using like ".$row['something']." for each row and that didn't work either. I searched Google and couldn't find anything. I know I could do this a lot easier using multiple echos because I've already had it like that but one echo would be more efficient I'm guessing...plus I know there is a way to do it like this and I want to learn it. Link to comment https://forums.phpfreaks.com/topic/61460-solved-echoing-rows-and-html-in-one-echo/ Share on other sites More sharing options...
Wildbug Posted July 24, 2007 Share Posted July 24, 2007 Change the array elements from $row['whatever'] to {$row['whatever']} Link to comment https://forums.phpfreaks.com/topic/61460-solved-echoing-rows-and-html-in-one-echo/#findComment-305891 Share on other sites More sharing options...
Aureole Posted July 24, 2007 Author Share Posted July 24, 2007 Parse error: syntax error, unexpected ';', expecting '}' in /home/veraci7y/public_html/index.php on line 172 That's what I get, my code is below just in case. echo "<a href=\"http://www.veraci7y.net/news/read.php?id={$row['id'];}\" target=\"_blank\" title=\"Read full story...\" class=\"newstitle\">{$row['title'];}</a><p class=\"newsinfo\">Posted by <a href=\"http://www.veraci7y.net/forums/index.php?showuser={$row['authorid'];}\" class=\"user\" title=\"View Member\'s Profile\">{$row['author'];}</a> <span class=\"newsdate\">{$row['prettydate'];}</span></p><p class=\"newscontent\">{$row['short'];}</p>"; This echo does come after this: while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { Would the "{" there not interfere? ??? Just a random guess. Link to comment https://forums.phpfreaks.com/topic/61460-solved-echoing-rows-and-html-in-one-echo/#findComment-305894 Share on other sites More sharing options...
Wildbug Posted July 24, 2007 Share Posted July 24, 2007 Remove the semi-colon. (See PHP manual under the string type for methods of interpolating variables.) Link to comment https://forums.phpfreaks.com/topic/61460-solved-echoing-rows-and-html-in-one-echo/#findComment-305901 Share on other sites More sharing options...
Aureole Posted July 24, 2007 Author Share Posted July 24, 2007 I really should probably go through the manual shouldn't I? I'll try what you said anyway, thanks. I'm an idiot, I know that a semi-colon denotes the end of a line I just always miss things this simple...sorry. Link to comment https://forums.phpfreaks.com/topic/61460-solved-echoing-rows-and-html-in-one-echo/#findComment-305902 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.