runnerjp Posted August 25, 2008 Share Posted August 25, 2008 i cant really figure this one out but i have my forum set up .... but what i would like to know is how would i go about it so that if a post has been made in the thread the users image changes... currently i can make it so if the user has created the thread this can be done.. <?php $getthreads = "Select * from forumtutorial_posts where parentid='0' and forum = '$forum' ORDER BY important DESC, lastrepliedto DESC $max"; $getthreads2 = mysql_query($getthreads) or die("Could not get threads"); while ($getthreads3 = mysql_fetch_array($getthreads2)) { $getthreads3[title] = strip_tags($getthreads3[title]); $getthreads3[author] = strip_tags($getthreads3[author]); $getthreads3[important] = strip_tags($getthreads3[important]); $important = $getthreads3['important']; ?> <?php if ($getthreads3[author] == $puser) { ?> <img src="http://www.runningprofiles.com/images/new_posts_icon.gif" alt="My" /> <? } else { ?> <img src="http://www.runningprofiles.com/images/last_post.gif" alt="My" /> <? } ?> <td width="4%" align="center" valign="middle"><?php if ($getthreads3['forumlock'] == 1) { echo ' <img src="http://www.runningprofiles.com/images/quick_lock.gif" alt="locked"/>'; } if ($getthreads3['important'] == 1) { echo '<img src="http://www.runningprofiles.com/images/sticky.gif" alt="sticky"/>'; } ?> now could i do it some how like this--- add <?php $getrep = "Select * from forumtutorial_posts where author = $getthreads3[author] AND parentid=$getthreads3[parentid]=$getthreads3[postid]"; $getrep2 = mysql_query($getreps) or die("Could not get threads"); while ($getrep3 = mysql_fetch_array($getrep2)) { $parentid = $getrep3['parentid']; ?> if ($getthreads3[author] == $puser and $getthreads3[parentid] == $parentid ) { parent id hold the id of the origional post... is there a easyer and better way about going about this? Quote Link to comment Share on other sites More sharing options...
joquius Posted August 25, 2008 Share Posted August 25, 2008 I'm saving my aspirin for a rainy day, so for the moment, for the sake of clarity, give your variables better names. For instance: <?php $getthreads = "Select * from forumtutorial_posts where parentid='0' and forum = '$forum' ORDER BY important DESC, lastrepliedto DESC $max"; $getthreads2 = mysql_query($getthreads) or die("Could not get threads"); while ($getthreads3 = mysql_fetch_array($getthreads2)) ?> becomes <?php $sql = "SELECT * FROM forumtutorial_posts WHERE `parentid` = '0' AND `forum` = '$forum' ORDER BY `important` DESC, `lastrepliedto` DESC LIMIT $max"; $res = mysql_query( $sql ) or die( "Could not get threads" ); while ( $data = mysql_fetch_array( $res ) ) ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.