Jump to content

Trying to create a Forum


PhillNeedsHelp

Recommended Posts

Ok.. I am trying to create a forum. This is the plan the user info in the left column (Displayed from the users table) And the forum post (from the forum table) I have a username which is sent to the post table which then selects the user info from the users table.

 

The problem is when I enter multiple records... It doesn't show them! It will just show 1 record.. Anyone help please?

Link to comment
Share on other sites

Hey thanks for reply

 

Heres the two scripts:

 

<?php
  
$dbh=mysql_connect ("localhost", "usersl", "pass") or die ('I cannot connect to the database because: ' . mysql_error());
        mysql_select_db ("phil_forum"); 


   $query = "SELECT username, forum  FROM forum WHERE question=$id";
    $result = mysql_query ($query) or trigger_error("Query: $query\n<br />Mysql error: " . mysql_error());

    while($row = mysql_fetch_array($result)) {
     $un = $row['user_name'];

     include('user-info.php');
    
}
?>

That's the forum reply script.. Heres the user-info


Code:
<?php
$dbh=mysql_connect ("localhost", "user", "pass") or die ('I cannot connect to the database because: ' . mysql_error());
     mysql_select_db ("phil_useraccounts");

   $query = "SELECT user_name, user_id, motto, badge, user_group FROM users WHERE user_name='$un'";
   $result = mysql_query ($query) or trigger_error("Query: $query\n<br />Mysql error: " . mysql_error());

    while($row = mysql_fetch_array($result)) {

   $user = $row['user'];

  echo '<img src="http://www.mysite.com?user=' .$user. '&action=&direction=2&head_direction=2&size=1&img_format=gif"><img 


}
?>

Link to comment
Share on other sites

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.