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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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