Web Analytics Made Easy -
StatCounter Ranking system chart HELP !!! - CodingForum

Announcement

Collapse
No announcement yet.

Ranking system chart HELP !!!

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

  • Ranking system chart HELP !!!

    Okay so i have two scripts i been working on the registration/login & upload. so in order to finish my project off, i need a ranking system after i submit my replay or file. i have a print screen of how i would like it to be and i think i have a idea of how to code it but i will need assistance.



    Here is what i have as for the upload.php + display_reps.php+process_upload.php

    upload.php
    PHP Code:
    <?php
        session_start
    ();
    ?>

    <html>
    <body>
    <link rel="stylesheet" type="text/css" href="main.css" />

    <?php

    $host
    ="localhost"// Host name
    $username="dangmnne_dangmnx"// Mysql username
    $password=""// Mysql password
    $db_name="dangmnne_test"// Database name

    // Connect to server and select databse.
    mysql_connect("$host""$username""$password")or die("cannot connect");
    mysql_select_db("$db_name")or die("cannot select DB");

    ?>

    <div style="width:450px; height:15px; border:1px solid black; background-color: #535353; color: white; padding: 2px;">
    <strong>Loser</strong></div>

    <div style="width:444px; height:55px; border-left:1px solid black; border-right:1px solid black; border-bottom:1px solid black; background-color: #C0C0C0; color: #000; padding: 5px;">

    <p>Please select the correct opponent.</p><br />

    <form>
    <select name="members">

    <?php
    $query 
    mysql_query("SELECT username FROM members");
    while(
    $row mysql_fetch_array($query))
    {
    echo 
    "<option>".$row['username']."</option>";
    }
    ?>

    </select>
    </form>
    </div>

    <br />

    <div style="width:221px; height:15px; border:1px solid black; background-color: #535353; color: white; padding: 2px;">
    <strong>Replay</strong></div>

    <div style="width:215px; height:85px; border-left:1px solid black; border-right:1px solid black; border-bottom:1px solid black; background-color: #C0C0C0; color: #000; padding: 5px;">
    <p>Please select the correct replay.</p><br />

    <form action="process_upload.php" method="post" enctype="multipart/form-data">
    <input type="file" name="file" id="file" />
    <br />
    <input type="submit" name="Upload" value="Submit" />
    </form>
    </div>

    </body>
    </html>
    display_reps.php
    PHP Code:
    <?php

    $db 
    mysql_connect('localhost''dangmnne_dangmnx'''); //fill in host, hostname, hostpass with your own

    if (!$db)
      {
      die(
    'Could not connect: ' mysql_error());
      }


    $db_selected mysql_select_db('dangmnne_test'$db); //fill in DBname with your own

    if (!db_selected)
    {

    die(
    "cant connect");

    }

    $result mysql_query("SELECT replay FROM test");

    echo 
    "<table ALIGN='center' border='1'>
    <th><FONT COLOR='#000'>Replay</th>
    </tr>"
    ;


    while(
    $row mysql_fetch_array($result))
      {
      
      echo 
    "<tr>";
      echo 
    "<td ALIGN='CENTER'><FONT COLOR='#000'>" $row['replay'] . "</td>";
      echo 
    "</tr>";
       }
      
    echo 
    "</table>";

    mysql_close($db);

    ?>
    process_upload.php
    PHP Code:
    <?php

    $db 
    mysql_connect('localhost''dangmnne_dangmnx'''); //fill in host, hostname, hostpass with your own

    if (!$db)
      {
      die(
    'Could not connect: ' mysql_error());
      }


    $db_selected mysql_select_db('dangmnne_test'$db); //fill in DBname with your own

    if (!db_selected)
    {

    die(
    "cant connect");

    }

        if (
    $_FILES["file"]["error"] > 0)
        {
        echo 
    "Return Code: " $_FILES["file"]["error"] . "<br />";
        }
      else
        {
            
    move_uploaded_file($_FILES["file"]["tmp_name"], "/home/dangmnne/public_html/hp/upload/" $_FILES["file"]["name"]);

            
    $replay "" $_FILES["file"]["name"];
            
    $replay2 "<a href=\"http://www.dangmn.net/hp/upload/" .$replay"\"><img src = \"http://www.dangmn.net/hp/image.jpg\" style=\"border-style: none\"/></a>"//replace "yoursite" with your own site

            
    $query "INSERT INTO test (replay)
    VALUES ('"
    .$replay2."')";

    $result mysql_query($query) or die(mysql_error());

    mysql_close($db);
            


    ?>

    <p>upload was sucessful click<a href="report.php"> here </a>to return</p>
    So what i was thinking was to create a table which consist of
    ranked, points, player, record, replay,
    Loser and etc,

    would that be a good idea? i could not find a single tutorial on google, yahoo for this.

    Here is the perfect example of how i want it to be displayed out as well.

    http://wezrules.byethost9.com/leaguetable.php

  • #2
    Storing each player's ranking will be a real pain. When you want to display a player's ranking, why not just calculate the ranking based on a player's record?

    Comment

    Working...
    X