Web Analytics Made Easy -
StatCounter Select question - CodingForum

Announcement

Collapse
No announcement yet.

Select question

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Select question

    I've been having troubles with an Select function. I want it to display a signature a avatar, a poster name and the message, and it only does the poster name and the message. Here's my code:
    PHP Code:
    <?php 
       
    /* Maak connection */ 
       
    $db mysql_connect("localhost""user""pass"); 
       
    mysql_select_db("db"); 
        
       
    /* Read the message */ 
       
    $sql "SELECT id, naam, titel, inhoud FROM forum WHERE id='$id'"
       
    $result mysql_query($sql) or die(mysql_error()); 
       
    $sql2 "SELECT avatar, signature, user_name FROM tbl_users WHERE user_name='$row->naam'"
       
    $result2 mysql_query($sql2) or die(mysql_error());  
          
    $row mysql_fetch_object($result); 
          
    $row2 mysql_fetch_object($result2); 
          echo 
    "<table width=\"600\" border=\"1\" bordercolor=\"000000\" cellpadding=\"0\" cellspacing=\"0\">\n"
          echo 
    "<tr>\n"
          echo 
    "\t<td>$row2->avatar <br> $row->naam</td>\n"
          echo 
    "\t<td>$row->inhoud <br>_____________________<br>$row2->signature</td>\n"
          echo 
    "</tr>\n";  
          echo 
    "</table><p>\n"
          echo 
    "<a href='users/newtopic.php?replyto=$id'>Reply</a>"
    ?>
    What's wrong with this? Please help.
    Cheers MPCODER

  • #2
    Sorry, found it out. The code didn't know what $row was, so it thought that is was empty. So it said that user_name was empty, and selected nothing.
    Cheers MPCODER

    Comment

    Working...
    X