Results 1 to 6 of 6
  1. #1
    Join Date
    Dec 2006
    Location
    Kent, UK
    Posts
    627
    Tokens
    138
    Habbo
    Romanity

    Latest Awards:

    Default Averages with PHP

    Right... heres what I got so far

    PHP Code:
    $mean = array( 246);
    $mean array_sum($mean);
    $mean $mean/4;
    echo 
    "$mean"
    Which does give 5 as the answer
    Problem is i cant remember how to get the array from the database :S

    PHP Code:
    $mean = array( ALL DATABASE VALUES); 
    Is what I need.... whats the function??? :S
    Sangreal / Romanity ~ Habbo UK & USA
    [OurHabbo.Net Owner]
    Lewis. (Formerly xRoyal15)

  2. #2
    Join Date
    May 2006
    Posts
    1,797
    Tokens
    0

    Latest Awards:

    Default

    PHP Code:
    $sql mysql_query("select * from YOURDATABASETABLENAME");
    $mean mysql_fetch_array($sql); 
    Coming and going...
    Highers are getting the better of me

  3. #3
    Join Date
    Dec 2006
    Location
    Kent, UK
    Posts
    627
    Tokens
    138
    Habbo
    Romanity

    Latest Awards:

    Default

    Swear i tried that
    O well my bad (A)
    Cheers
    Sangreal / Romanity ~ Habbo UK & USA
    [OurHabbo.Net Owner]
    Lewis. (Formerly xRoyal15)

  4. #4
    Join Date
    Jun 2005
    Posts
    2,688
    Tokens
    0

    Latest Awards:

    Default

    MySQL has a built in average function avg() you may use.

    http://dev.mysql.com/doc/refman/5.0/...l#function_avg

  5. #5
    Join Date
    Sep 2005
    Location
    East London
    Posts
    3,028
    Tokens
    0

    Latest Awards:

    Default

    Quote Originally Posted by Baving View Post
    MySQL has a built in average function avg() you may use.

    http://dev.mysql.com/doc/refman/5.0/...l#function_avg
    Php pro ^

    I never knew about that site/function, cheers

  6. #6
    Join Date
    Dec 2006
    Location
    Kent, UK
    Posts
    627
    Tokens
    138
    Habbo
    Romanity

    Latest Awards:

    Default

    Cheers Alan
    Sangreal / Romanity ~ Habbo UK & USA
    [OurHabbo.Net Owner]
    Lewis. (Formerly xRoyal15)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •