Announcement

Collapse
No announcement yet.

mysql to select highest users's post count?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Gellpak
    replied
    yknow you could always just select MAX from the table....

    Leave a comment:


  • postalbobo
    replied
    Fixed! If you want, reload the source page and replace it. Now it works according to their post count in relation to the max post count. Wheee!

    Leave a comment:


  • postalbobo
    replied
    Ok, I'm finding that my math is all wrong here... I'm not getting things the right way. Have a look at the src:

    http://www.dirgotronix.net/test/glow.phps
    and the script in action:

    http://www.dirgotronix.net/test/glow...n&glowuserid=1

    looks like:

    1206 = top posts
    54 = multiplier
    purple = fav color
    1 = userid
    Jason = username
    800080 = fav color in hex
    128 0 128 = fav color in dec
    108 108 = adjusted color in dec
    6c006c = adjusted color in hex
    Jason - final output.

    yet, at 1206 posts, mine would be much brighter than my fav color (red is 162 where my fav is 128, etc)

    I'm lost...

    Leave a comment:


  • postalbobo
    replied
    duh

    Leave a comment:


  • postalbobo
    replied
    how did you get 65025?

    Leave a comment:


  • Chen
    replied
    I think this will do it:
    PHP Code:
    $colormultiplier "65025 / $highestpostcount"

    Leave a comment:


  • postalbobo
    replied
    I'm trying to set up a multiplier so that in my glowy color script (http://www.dirgotronix.net/test/glow.phps) it will poll the database for the highest post count (which atm is 1206), the post count of the #1 top postiing user.

    like I said, I need to find X for:

    255 = ( ( $highestpostcount / 255 ) * X )
    where $highestpostcount = 1206, but will change, of course.

    Then, I use X like so:

    X is set as $colormultiplier
    for each color (r,g,b) I run the following:
    PHP Code:
        // Red
            
    if ( $r 15 
                { 
                
    $r1 $glowposts 255
                
    $r1 round($r1); 
                
    $r1 = ( $r1 $colormultiplier ); 
                
    $rr dechex($r1); 
            } 
            else 
                { 
                
    $rr "0" dechex($r1); 
            } 
    where $r is the red value of the users favorite color, $glowposts is their post count. This means that people's usernames will glow brighter the more posts they have, and the top posts's glow will for example (for white) be FFFFFF as long as they are the top poster. If the top poster had 255 posts, the $colormultiplier would have to be set as 255, and go progressively lower as their post count grew.

    Leave a comment:


  • Chen
    replied
    I really don't understand what you are trying to do man. Can you be any more specific?

    Leave a comment:


  • postalbobo
    replied
    Ok next question:

    How do I code in the equivalent of this in php:

    255 = ( ( $highestpostcount / 255 ) * X )

    I need to find X to use it as a multiplier variable for the rest of the glowy color script I'm using, so that the brightest color will always be a postcount equal to the top poster's.

    Leave a comment:


  • Chen
    replied
    Re: mysql to select highest users's post count?

    Code:
    SELECT posts FROM user ORDER BY posts DESC LIMIT 1
    Last edited by Chen; Thu 23 Aug '01, 10:26am.

    Leave a comment:


  • postalbobo
    replied
    answered my own question.

    Leave a comment:


  • postalbobo
    started a topic mysql to select highest users's post count?

    mysql to select highest users's post count?

    I want to find the highest user post count to aid in an average for a script I'm working on, what would the sql query for that be?

    SELECT posts from user where posts > 0 ORDER BY posts DESC LIMIT 0, 1 ?
widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
Working...
X