Jump to content

Picture in forum!


gastooon

Recommended Posts

Hello! My problem is that in my forum I want to display the picutre of their user and if they do not have a picture I want to show the standard one. I got all of this working on another part of the page but for some reason I can only get it to display the standard picture and not their custom picture... The code looks like this:

 

<?php 
// Now query any responses out of the database and place in a dynamic list
$sqll = mysql_query("SELECT id FROM myMembers");
while($row = mysql_fetch_array($sqll)){

$id = $row["id"];

$check_pic = "..//members/$id/image01.jpg";
$default_pic = "..//members/0/image01.jpg";
if (file_exists($check_pic)) {
    $user_pic = "<img src=\"$check_pic\" align=\"left\" width=\"80px\" border=\"0\" />"; // forces picture to be 120px wide and no more
} else {
$user_pic = "<img src=\"$default_pic\" align=\"left\" width=\"80px\"  border=\"0\" />"; // forces default picture to be 120px wide and no more
}
}

$all_responses = "";
$sql = mysql_query("SELECT * FROM forum_posts WHERE otid='$thread_id' AND type='b'");
$numRows = mysql_num_rows($sql);
if ($numRows < 1) {
$all_responses = '<div id="none_yet_div">No respond has been posted yet.</div>';
} else {
    while($row = mysql_fetch_array($sql)){
$reply_author = $row["post_author"];
$reply_author_id = $row["post_author_id"];
$date_n_time = $row["date_time"];
$convertedTime = ($myAgoObject -> convert_datetime($date_n_time));
    $whenReply = ($myAgoObject -> makeAgo($convertedTime));
$reply_body = $row["post_body"];
$all_responses .= '<div class="response_top_div">Re: ' . $thread_title . '     |     ' . $whenReply . ' 
<a href="../profile.php?id=' . $reply_author_id . '">' . $reply_author . '</a> said:</div>
<div class="response_div" style="padding-left:20px; vertical-align:text-top;">' . $user_pic . ' <div style="padding-left:117px;"> ' . $reply_body . '</div></div>';
   }
}

?>

 

Please help me if you can! Thank you!

Link to comment
Share on other sites

Hello,

 

Lokking at your code i can see ur path is incorrect

 

              $check_pic = "..//members/$id/image01.jpg"; $default_pic = "..//members/0/image01.jpg";       

 

 

It should be

 

$check_pic = "../members/$id/image01.jpg"; $default_pic = "../members/0/image01.jpg";

Link to comment
Share on other sites

I thought that was the issue thats why i was checking the picture ;)

 

Seems like its 2 thinks

 

1) check the  path of your image ... is it correct? .. does it have the image in there??

2) right click on the html output and go to properties and copy the address url <- it might not show the user id!

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.