Help with Post rank script

Discussion in 'PHP' started by Dirty-Rockstar, Aug 11, 2007.

  1. #1
    real numbers i took out :p

    
    <?php
    require('config.php');
    
    // get value of id that sent from address bar
    $id=mysql_real_escape_string($_GET['id']);
    
    $sql="SELECT * FROM {$db_prefix}question WHERE id='$id'";
    $result=mysql_query($sql);
    $rows=mysql_fetch_array($result);
    
    if (!$rows) { die("Thread does not exist."); }
    
    $name=$rows['name'];
    $sticky=$rows['sticky'];
    include('header.php');
    
    
    
    
    $count_q1="SELECT * FROM {$db_prefix}question WHERE name='$rows[name]'";
    $count_q2=mysql_query($count_q1) or die(mysql_error());
    $count_q3=mysql_num_rows($count_q2);
    
    $count_a1="SELECT * FROM {$db_prefix}answer WHERE a_name='$rows[name]'";
    $count_a2=mysql_query($count_a1) or die(mysql_error());
    $count_a3=mysql_num_rows($count_a2);
    
    $num_count = $count_q3 + $count_a3;
    
    
    if ( $num_count <= 1 ) { $rank = Print "Thread lurker"; }
    else if ( $num_count <= 3 ) { $rank = Print "Noobish"; }
    else if ( $num_count <= 4 ) { $rank = Print "Forum Contributor"; }
    else if ( $num_count <= 5 ) { $rank = Print "Forum Addict"; }
    else if ( $num_count <= 7 ) { $rank = Print "Forum Spammer"; }
    else if ( $num_count <= 8 ) { $rank = Print "TCN Contributor"; }
    else if ( $num_count <= 9 ) { $rank = Print "TCN Addict"; }
    else if ( $num_count <= 99 ) { $rank = Print "TCN Spammer"; }
    else if ( $num_count <= 9999 ) { $rank = Print "TCN Recognized"; }
    else if ( $num_count <= 12345678 ) { $rank = Print "Needs TCN rehab"; }
    else if ( $num_count <= 999999999 ) { $rank = Print "Paid not to leave"; }
    ?>
    
    PHP:
    Then some admin crap...then

    
    <td align=left valign=top><!-- FORUM ID: <?=$rows['id']; ?> -->
    <h2><?=$rows['topic']; ?></h2>
    <hr>
    <strong><em class="info">Posted by <a href="view_profile.php?id=<?=$rows['name']; ?>"><?=$rows['name']; ?></a></em> at <?=$rows['datetime']; ?><br />Total posts: <?=$num_count; ?><br>Posting Rank: <?$rank ?><br /></strong><br />
    
    
    <?=$rows['detail'] ?>
    <br>
    Code (markup):

    post rank returns as 1. so im assuming "true" it wont print what i want. Im assuming i need some type of get thingy but i have no clue

    help? O_O
     
    Dirty-Rockstar, Aug 11, 2007 IP
  2. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #2
    
    <?$rank ?>
    
    PHP:
    Should be:
    
    <?php echo $rank; ?>
    
    PHP:
     
    nico_swd, Aug 11, 2007 IP
  3. Dirty-Rockstar

    Dirty-Rockstar Guest

    Messages:
    252
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #3
    thanks, but i totally did this wrong, i took out print in the if statements and fixed a few other things. now its just getting the value of posts from each individual person viewing.

    ei: i view threads and i see EVERYONES post rank as my own. and poster B sees the same thing only everyones is his post rank....woopsie

    1+ anyway = )

    cant 1+ you...i did at another time :S sorry, ill post the new script in a second
     
    Dirty-Rockstar, Aug 11, 2007 IP
  4. Dirty-Rockstar

    Dirty-Rockstar Guest

    Messages:
    252
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #4
    KABLAMMMMOOOO

    I fixed it myself. had to do with the bottom of the script. i needed to paste the script again for the post replies, change the var names and it works perfect. thank you for fixing the echo
     
    Dirty-Rockstar, Aug 11, 2007 IP