Hugos Posted September 9, 2019 Posted September 9, 2019 How do I add data from a database? (I use the plugin mta_mysql) Говорю на русском. Sorry for bad english.
Moderators IIYAMA Posted September 9, 2019 Moderators Posted September 9, 2019 (edited) 1 hour ago, Hugos said: How do I add data from a database? (I use the plugin mta_mysql) Add data to a database? INSERT INTO table_name (column1, column2 ) VALUES (?, ?) OR Get data from a database? SELECT * FROM table_name OR Import data to a database from another database. Edited September 9, 2019 by IIYAMA 1 Do you want to improve your Lua programming skills and make less mistakes? Start with Lua Language Server! Useful functions 3x Spoiler checkPassiveTimer getScreenStartPositionFromBox getPedGender Tutorials 4x Spoiler Scaling DX Events Attach an addEventHandler on a group of elements Debugging
Hugos Posted September 9, 2019 Author Posted September 9, 2019 (edited) 50 minutes ago, IIYAMA said: Add data to a database? INSERT INTO table_name (column1, column2 ) VALUES (?, ?) OR Get data from a database? SELECT * FROM table_name OR Import data to a database from another database. I get the player 's serial number at the moment, and if it 's not already recorded in the DB - I add. local username = getPlayerName(source) local serial = tostring(result_account.serial) local u_serial = getPlayerSerial(source) if (serial == u_serial) then --We check the serial number else if (serial == "") then --number will stop. Assign a new INSERT INTO accounts (, ) VALUES (?, ?) else end end How it is correct to make it? Edited September 9, 2019 by Hugos Говорю на русском. Sorry for bad english.
Moderators IIYAMA Posted September 9, 2019 Moderators Posted September 9, 2019 3 minutes ago, Hugos said: How it is correct to make it? Does that player already has an account? 1 Do you want to improve your Lua programming skills and make less mistakes? Start with Lua Language Server! Useful functions 3x Spoiler checkPassiveTimer getScreenStartPositionFromBox getPedGender Tutorials 4x Spoiler Scaling DX Events Attach an addEventHandler on a group of elements Debugging
Hugos Posted September 9, 2019 Author Posted September 9, 2019 (edited) 2 minutes ago, IIYAMA said: Does that player already has an account? Yes. It is already registered (nikneim in recorded in "username") Edited September 9, 2019 by Hugos Говорю на русском. Sorry for bad english.
Moderators IIYAMA Posted September 9, 2019 Moderators Posted September 9, 2019 5 minutes ago, Hugos said: Yes. It is already registered (nikneim in recorded in "username") Something like that: dbExec (db, "UPDATE accounts SET serial = ? WHERE username = ?", u_serial, username) 1 Do you want to improve your Lua programming skills and make less mistakes? Start with Lua Language Server! Useful functions 3x Spoiler checkPassiveTimer getScreenStartPositionFromBox getPedGender Tutorials 4x Spoiler Scaling DX Events Attach an addEventHandler on a group of elements Debugging
Hugos Posted September 9, 2019 Author Posted September 9, 2019 9 minutes ago, IIYAMA said: Something like that: dbExec (db, "UPDATE accounts SET serial = ? WHERE username = ?", u_serial, username) THANKS!!!! 1 Говорю на русском. Sorry for bad english.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now