runnerjp Posted January 23, 2009 Share Posted January 23, 2009 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 Quote Link to comment https://forums.phpfreaks.com/topic/142093-solved-echoing-out-forum-posts/ Share on other sites More sharing options...
gevans Posted January 23, 2009 Share Posted January 23, 2009 One problem A semi-color ';' after your curly bracket closing the while statement (needs to be after the echo statement) Quote Link to comment https://forums.phpfreaks.com/topic/142093-solved-echoing-out-forum-posts/#findComment-744168 Share on other sites More sharing options...
runnerjp Posted January 23, 2009 Author Share Posted January 23, 2009 <?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 Quote Link to comment https://forums.phpfreaks.com/topic/142093-solved-echoing-out-forum-posts/#findComment-744171 Share on other sites More sharing options...
gevans Posted January 23, 2009 Share Posted January 23, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/142093-solved-echoing-out-forum-posts/#findComment-744174 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.