How to update an entry if it exists already

Discussion in 'Plugin Development' started by Tythus, Feb 28, 2014.

Thread Status:
Not open for further replies.
  1. Offline

    Tythus

    Code:
    INSERT INTO user (user, tokens) VALUES ('tythus', '4');
    So if the user 'tythus' already exists how do I make it update instead?

    sir bumps a lot

    >_>

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 7, 2016
  2. Offline

    Maulss

    "UPDATE `<table>` SET <column> = <value> WHERE <row> = <value>"

    EDIT: More specifically, in your case, you would do this:
    "UPDATE user SET tokens = 4 WHERE user = tythus"
     
Thread Status:
Not open for further replies.

Share This Page