There is a table that stores the values ​​of username and money . How to insert into it values ​​that are updated with the following class .

The bottom line is that if the username and amount are not in the table, then the values ​​are not recorded, and then they do not change accordingly. How to fix it?

You can get the user you want to add to the table with the acc.getName () function

  • See the class that inserts into the st_users table; in the class you just mentioned, it is assumed that there is already an entry for each user. Why there are accounts that are not in this table? - a.chugunov

1 answer 1

Make a check? Run the Update Request. If the error is such and such, then insert request. If I understand the question correctly.

  • The problem is that I know very little sql and therefore came here. And again, I do not know how to create these checks correctly. In general, a complete zero, but the problem is solved as it should. There is an option to crutch when registering on the site, but the database is remote from the site on another machine, so you will also have to be very misty. - tperson
  • Look at try catch (exception handling) and simple sql queries (there is something similar in your class) - Arantler
  • Well, I can see. Thank. - tperson