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
https://forums.phpfreaks.com/topic/101358-trying-to-create-a-forum/
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 


}
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.