Results 1 to 2 of 2
  1. #1
    Join Date
    May 2013

    Unanswered: sql query on update

    I need help on this sql

      .mysql_real_escape_string($player['name'])."', '".$player['score']."', '".$player['goal']."', '".$player['leader']."', '".$player['enemy']."', '$kia', '$roe'"
            .") ON DUPLICATE KEY UPDATE `score`=score+'".$player['score']."', `goal`=goal+'".$player['goal']."', `leader`=leader+'".$player['leader']
            ."', `enemy`=enemy+'".$player['enemy']."', `kia`=kia+'$kia', `roe`=roe+'$roe'"
    this right now does allways adds new values , what I need is that the " on dublicate update " function only updates the " score " when the new value is higher then the one .

    EDİIT : I have did try this : " ON DUPLICATE KEY UPDATE `score`=$score " but this time it does set the value to zero if the new value is lower then first. If it is higher then the one in the table it does the job and adds the new value.
    Last edited by dev48; 05-20-13 at 08:18.

  2. #2
    Join Date
    Feb 2004
    In front of the computer
    Provided Answers: 54
    See my reply to your previous post about this issue. You may need to combine that answer with this question to get what you truly want.

    In theory, theory and practice are identical. In practice, theory and practice are unrelated.

Posting Permissions

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