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
https://forums.phpfreaks.com/topic/238189-picture-in-forum/
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
https://forums.phpfreaks.com/topic/238189-picture-in-forum/#findComment-1223979
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
https://forums.phpfreaks.com/topic/238189-picture-in-forum/#findComment-1225796
Share on other sites

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.