Jump to content

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.

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.