Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2

Thread: Simple Forum

  1. #1
    Regular Coder
    Join Date
    Jul 2005
    Posts
    153
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Simple Forum

    Hello

    I am making a simple forum for my website.

    When viewing the thread you can leave comments, this all works fine. But i am trying to add the users details to each comment left.


    PHP Code:
      $sql "SELECT * FROM comment WHERE thread_id = $thread_id ORDER BY comment_id";
      
    $result mysql_query($sql$conn) or die(mysql_error());
      while (
    $newArray mysql_fetch_array($result)) {
          
    $comment_id $newArray['comment_id'];
          
    $comment_comment $newArray['comment_comment'];
          
    $comment_date $newArray['comment_date'];
          
    $user_id $newArray['user_id'];
    ///////////////////////// 
    How can i get the data from the members table?
    I need to get user name and picture from the id given from the comments table?
    PHP Code:
    /////////////////////////////
    echo "<table width='570' border='0'>
      <tr>
        <td width='100' align='left' valign='top'<br><img src='http://www.mysite.com/$picture' width='80' height='80' /></td>
        <td><p>$comment_comment </td>
      </tr>
    </table>

    Sorry to make it confusing.

  • #2
    Regular Coder
    Join Date
    Jul 2005
    Posts
    153
    Thanks
    1
    Thanked 0 Times in 0 Posts
    I have got this so far, but it is displaying the same picture for every user?

    PHP Code:
    $sql "SELECT comment.comment_id, comment.comment_comment, comment.comment_date, comment.user_name, comment.user_id, comment.comment_admin, MAX(members.picture ) FROM comment, members WHERE comment.thread_id = $thread_id GROUP BY comment.user_id";
      
    $result mysql_query($sql$conn) or die(mysql_error());
    while(
    $row mysql_fetch_row ($result))


    I got the rest working, just want to sort out the photo


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •