Jump to content

"posted" in forums


runnerjp

Recommended Posts

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?

Link to comment
Share on other sites

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 ) ) 
?>

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.