runnerjp Posted May 31, 2008 Share Posted May 31, 2008 for some reason when and try and get the users image via $getuser="SELECT * FROM users WHERE Username = ".$gettopic3['author']." "; $getuser2=mysql_query($getuser) or die("Could not get user"); while($getuser3=mysql_fetch_array($getuser2)){ $getthreads3['image']=strip_tags($getthreads3['image']); echo $$getthreads3['image']; i echo the query and it worked fine SELECT * FROM users WHERE Username = Admin the full code is below <table class='maintable'> <tr class='headline'><td width=20%>Author</td><td width=80%>Post</td></tr> <?php if ($pagenum == 1){ ?> <tr class='mainrow'><td valign='top'><?php echo $gettopic3['author'] ; $getuser="SELECT * FROM users WHERE Username = ".$gettopic3['author']." "; $getuser2=mysql_query($getuser) or die("Could not get user"); while($getuser3=mysql_fetch_array($getuser2)){ $getthreads3['image']=strip_tags($getthreads3['image']); echo $$getthreads3['image']; } ?> </td> <td vakign='top'>created on <?php echo $gettopic3['showtime']?><br> <hr> <p> <?php $message=$gettopic3['post']; $message=nl2br($message); ?> <?php echo $message ?></p> <p><br> </p></td></tr> <?php } $getreplies="Select * from forumtutorial_posts where parentid='$id' $max"; //getting replies $getreplies2=mysql_query($getreplies) or die(mysql_error()."Could not get replies"); while($getreplies3=mysql_fetch_array($getreplies2)) { ?><tr class='mainrow'><td valign='top'><?php echo $getreplies3['author']?> </td><td vakign='top'>replied at <?php echo $getreplies3['showtime']?> <br> <hr> <p> <?php $message=$getreplies3['post']; $message=nl2br($message); ?> <?php echo $message?></p> <p><br> </p></td></tr> <? } ?> </table> Link to comment https://forums.phpfreaks.com/topic/108145-solved-grabbing-a-users-image/ Share on other sites More sharing options...
jonsjava Posted May 31, 2008 Share Posted May 31, 2008 forgot single quotes: $getuser="SELECT * FROM users WHERE Username = '".$gettopic3['author']."' "; Link to comment https://forums.phpfreaks.com/topic/108145-solved-grabbing-a-users-image/#findComment-554327 Share on other sites More sharing options...
runnerjp Posted May 31, 2008 Author Share Posted May 31, 2008 oh boy that waa an easy 1 lol... sorry just learn today about the doubble n single quotes thing lol Link to comment https://forums.phpfreaks.com/topic/108145-solved-grabbing-a-users-image/#findComment-554329 Share on other sites More sharing options...
runnerjp Posted May 31, 2008 Author Share Posted May 31, 2008 ok i have a quote issue again in my link echo "<img src=\"http://www.runningprofiles.com/images/$getuser3['image']\" border=\"0\" />"; im styill not quite sure how to do $getuser3['image'] Link to comment https://forums.phpfreaks.com/topic/108145-solved-grabbing-a-users-image/#findComment-554340 Share on other sites More sharing options...
jonsjava Posted May 31, 2008 Share Posted May 31, 2008 safest bet: <?php $image = $getuser3['image']; echo "<img src=\"http://www.runningprofiles.com/images/$image\" border=\"0\" />"; Link to comment https://forums.phpfreaks.com/topic/108145-solved-grabbing-a-users-image/#findComment-554341 Share on other sites More sharing options...
peranha Posted May 31, 2008 Share Posted May 31, 2008 should be echo "<img src=\"http://www.runningprofiles.com/images/$getuser3[image]\" border=\"0\" />"; without the ' quotes in the url Link to comment https://forums.phpfreaks.com/topic/108145-solved-grabbing-a-users-image/#findComment-554342 Share on other sites More sharing options...
DarkWater Posted May 31, 2008 Share Posted May 31, 2008 ALL arrays need to be enclosed in { } to be used in double quotes. Link to comment https://forums.phpfreaks.com/topic/108145-solved-grabbing-a-users-image/#findComment-554344 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.