Announcement

Collapse
No announcement yet.

Mysql CHANGE/ UPDATE actions

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

  • Mysql CHANGE/ UPDATE actions

    Hi.

    I have a problem with changing the data in rows inside the tables.
    I managed to create and populate the table

    result = MySQL.Query("create table Users(userid integer primary key, LastName text, FirstName text, Age integer)");


    result = MySQL.Query("insert into Users values(1,'Sellers','Ted',48)");
    result = MySQL.Query("insert into Users values(2,'Blow','Joe',64)");

    etc.

    I also managed to delete certain row:

    line = 1
    result = MySQL.Query("DELETE FROM Users WHERE userid = ".. line .."");

    But i can't use the CHANGE or UPDATE action to just change the data in row
    right now i need to DELETE than to INSERT again but i have problems using this metod.
    Can anyone write a simple script for changing the data in rows. thx

  • #2
    I am not sure, but try this:
    result = MySQL.Query("DELETE FROM Users WHERE userid = '".. line .."';");
    You might need to add a single quotes ' '

    Comment


    • #3
      Try This

      Code:
      local line = 1;
      local strFirstName = "John";
      local strLastName = "Doe";
      local nAge = 44;
      MySQL.Query("UDTADE Users SET LastName = '"..strLastName.."' , FirstName = '"..strFirstName.."' , Age = "..nAge.." WHERE userid = ".. line ..";");
      amsplugins.com Is Closed.

      Facebook Page

      Comment

      Working...
      X
      😀
      🥰
      🤢
      😎
      😡
      👍
      👎