Jump to content

[SOLVED] Echoing rows and html in one echo()...


Aureole

Recommended Posts

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

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.

Archived

This topic is now archived and is closed to further replies.

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