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. Quote Link to comment 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']} Quote Link to comment 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. Quote Link to comment 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.) Quote Link to comment 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.