Jump to content

[SOLVED] echoing out forum posts...


runnerjp

Recommended Posts

its been awhile since i have done php and i am abit rusty...

 

having cut down the code i am just wondering why it will not echo out the results

 

<?php $sql = "Select * FROM forumtutorial_posts where author = '$profilename' ORDER BY `showtime` DESC LIMIT 0, 5";
$result = mysql_query($sql) or die("Could not get threads");

?>
                <table class="profilepbs" width="80%" align="center" cellpadding="0" cellspacing="0">
                  <tr>
                    <td height="97"  align="center" valign="top" h="h"><p>My forum posts                      </p>
                   <?php while($row = mysql_fetch_assoc($result)) { echo ' <a id="posts" href="http://www.runningprofiles.com/members/index.php?page=message&forum='.$row['forum'].'&id='.$row['postid'].'&pagenum=last">'.$row['title'].'</a>' };?></td>

 

 

i belive its somethign here  <?php while($row = mysql_fetch_assoc($result)) { echo ' <a id="posts" href="http://www.runningprofiles.com/members/index.php?page=message&forum='.$row['forum'].'&id='.$row['postid'].'&pagenum=last">'.$row['title'].'</a>' };?>

 

quite possibly the {} but im sure they should be there from what i remeber

Link to comment
https://forums.phpfreaks.com/topic/142093-solved-echoing-out-forum-posts/
Share on other sites

<?php while($row = mysql_fetch_assoc($result)) { echo ' <a id="posts" href="http://www.runningprofiles.com/members/index.php?page=message&forum='.$row['forum'].'&id='.$row['postid'].'&pagenum=last">'.$row['title'].'</a>' };?>

 

you mean the one i have highlighted bold ... this cant be it surly

Well that is the problem...

 

<?php while($row = mysql_fetch_assoc($result)) { echo ' <a id="posts" href="http://www.runningprofiles.com/members/index.php?page=message&forum='.$row['forum'].'&id='.$row['postid'].'&pagenum=last">'.$row['title'].'</a>' };?>

 

should be

 

<?php while($row = mysql_fetch_assoc($result)) { echo ' <a id="posts" href="http://www.runningprofiles.com/members/index.php?page=message&forum='.$row['forum'].'&id='.$row['postid'].'&pagenum=last">'.$row['title'].'</a>'; }?>

 

Also you don't check if you're getting any results from your db, mysql_num_rows maybe?

 

You seem to know your stuff so I'll let you figure it out.

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.