SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Wizard frank1's Avatar
    Join Date
    Oct 2005
    Posts
    1,392
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    how to update ranks

    i have player table which has these fields (player_id,name,rank) there are around 300 players...
    so the rank are updated may be once a 3 month...
    and when new ranks are published i need to update may be most of players rank....
    now i have the update mechanism..which consist of individual update
    taking name from down and manually do one by one
    update ............where player_id=$id

    but doing one by one is so tedious ...
    can any body suggest me better way....doing in bulk...

    same is about the country's rank...

    any idea that i can do...
    even looping didn't produce good results

  2. #2
    *********! *********!!! jackli's Avatar
    Join Date
    Sep 2005
    Posts
    436
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    how are the ranks calculated?

  3. #3
    SitePoint Wizard frank1's Avatar
    Join Date
    Oct 2005
    Posts
    1,392
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ranks are inserted as 1 2 3 and when official organization updates it we update it accordingly

  4. #4
    SitePoint Wizard silver trophy
    Join Date
    Mar 2006
    Posts
    6,132
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    PHP Code:
    while ($row mysql_fetch_assoc($res)) {
        
    printf('<input type="text" name="ranks[%s]" value="%s">'$row['id'], $row['rank']);

    then you have a form which lists every person in the db with thier current rank. you enter a new rank for each and submit the whole form once.

    receive form like
    PHP Code:
    foreach ($_POST['ranks'] as $id => $rank) {
        echo 
    "$id$rank, update the db.";

    http://wwwphp.net/manual/en/faq.html...aq.html.arrays


Bookmarks

Posting Permissions

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