ale89 0 Newbie Poster

Hi everyone!
On the main page of my web page displays the latest tracks created, which shows the title of the subject, who did it, the category in which I believe and the facade.
But now I would like to show your profile picture thumbnail which takes you to their profile.
I have created a folder called members in which when a user logs folder is created with the id. Example: members / id and the folder id is your profile photo.
This is my php code:

<?php

include('./global.php');

$sql = "SELECT
            categories.cat_id,
            categories.cat_name,
            categories.cat_description,
            COUNT(topics.topic_id) AS topics
        FROM
            categories
        LEFT JOIN
            topics
        ON
            topics.topic_id = categories.cat_id
        GROUP BY
            categories.cat_name, categories.cat_description, categories.cat_id";

$result = mysql_query($sql);
if(!$result)
{
    echo 'Unable to display the latest topics, please try again later.';
}
else
{
    if(mysql_num_rows($result) == 0)
    {
        echo 'There are no categories.';
    }
    else
    {
        echo '
         
<div class="group" id="main-content">
    

      <div class="content-container">
    
                <div class="view view-blog view-id-blog view-display-id-page_1 view-dom-id-1 content-section">
    
  
  
     
        ';
       
     
        while($row = mysql_fetch_assoc($result))
        {                
                
                //fetch last topic for each cat
                    $topicsql = "SELECT
                                    topic_id,
                                    topic_subject,
                                    topic_date,
                                    topic_cat,
                                    topic_by,
                                    users.id,
                                 users.username
                                FROM
                                    topics
                                 
                                 LEFT JOIN
                        users
                    ON
                        topics.topic_by = users.id
                                WHERE
                                    topic_cat = " . $row['cat_id'] . "
                                ORDER BY
                                    topic_date
                                DESC
                                LIMIT
                                    5";
                                
                    $topicsresult = mysql_query($topicsql);
                
                    if(!$topicsresult)
                    {
                        echo 'Unable to display the latest news ..';
                    }
                    else
                    {
                        while($topicrow = mysql_fetch_assoc($topicsresult))
                        
   echo '
                          <div class="view-content">
        <div class="views-row views-row-1 views-row-odd views-row-first">
    <div class="post group">

  <div class="post-thumbnail">
    <div class="picture">
  <a href="profile/?id='. $topicrow['id'] .'">';?><img src="members/<?php echo "$id"; ?>/pic1.jpg" class="user-picture" /><?
  echo '
  </a></div>
  
  </div>
    <div class="group">
        <div class="post-meta">
            <h4 class="post-title"><a href="topic.php?id=' . $topicrow['topic_id'] . '">' . $topicrow['topic_subject'] . '</a></h4>
              <span>Por <a href="profile/?id='. $topicrow['id'] .'"> '. $topicrow['username'] .'</a> el '.date('d-m-Y H:i', strtotime($topicrow['topic_date'])).'</span>

            <div>
      <ul class="links inline"><li class="taxonomy_term_3 first last"><a href="category.php?id=' . $row['cat_id'] . '">' . $row['cat_name'] . '</a></li>
</ul>    </div>
      </div>
    <div class="post-body">
    <p>content...</p>
  </div>
  </div>

<div>
  </div>
</div>
  </div>
';

   
    
                            
                        }
        } 
        
        echo '
        
  
</div>       </div>

    </div> 
        ';
    }
}
?>

Where's members / <?php echo "$ id"?> Show the user's photo.
Any ideas or suggestions how to do it I thank you all!
Thank you very much and greetings!:)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.