Desaster Posted September 28, 2013 Share Posted September 28, 2013 hello, I am trying to learn some SQl so I mean how to save some data with sql can you give me the function that are useful or if you have some time can you explain me in not much words what i can do or how it work thnx for reading Link to comment
Castillo Posted September 28, 2013 Share Posted September 28, 2013 You mean SQLite or MySQL? Link to comment
Castillo Posted September 28, 2013 Share Posted September 28, 2013 Use: executeSQLQuery Link to comment
Desaster Posted September 28, 2013 Author Share Posted September 28, 2013 (edited) I readed some things in wiki but i really can't understand for example how to save a player state for example getElementData ( thePlayer, "AFK" ) and to call it again Edited September 28, 2013 by Guest Link to comment
Baseplate Posted September 28, 2013 Share Posted September 28, 2013 INSERT INTO syntax to save a player stat, and then SELECT FROM syntax to select/call it again.. Link to comment
Desaster Posted September 28, 2013 Author Share Posted September 28, 2013 For example : -- create table addEventHandler ("onResourceStart", root, function() executeSQLQuery("CREATE TABLE IF NOT EXISTS stats(afk STRING)") end ) function save () executeSQLQuery("UPDATE stats SET afk=? WHERE account=?",--[[function if I am afk]]-- , acc) addEventHandler("onPlayerLogout", root, save) but how to make it true or false Link to comment
Markeloff Posted September 29, 2013 Share Posted September 29, 2013 Well, I have to ask also which better SQLite or MySQL? Link to comment
Baseplate Posted September 29, 2013 Share Posted September 29, 2013 Everyone got his own opinion, I find SQLite easier to use and more helpful, others may disagree but this is my own opinion. Link to comment
denny199 Posted September 29, 2013 Share Posted September 29, 2013 SQLite is more for saving data on the server for direct acces for the server only. MySQL is more for saving data to a server and then gain it on other servers, so for example websites, or your second server. Link to comment
myonlake Posted September 29, 2013 Share Posted September 29, 2013 Answered the same question a while ago. Generally it's up to you which one you like the most, but to enjoy all features of SQL, you should choose MySQL (especially if you have a big server with a lot of data). MTA Internal Database + Simple functions and use + No need to set up and install an external server for database - Limited actions - Doesn't have the ability to do stuff that SQLite/MySQL does (altering, etc.) - Slow (?) MySQL + Ability to make tables to save specific data in + Ability to modify tables and do stuff with them + Good for big data saving and managing - Slower than SQLite - Need of an external server to run - Easy but complex querying SQLite + Fast + Nearly the same abilities as in MySQL (limited however) + Good for semi-big data saving and managing + No need for an external server in order to save - Doesn't have all the abilities than in MySQL - Easy but complex querying If you want to save a few stuff about a few things then you can use the internal database or SQLite. If you're saving a lot, use MySQL or SQLite. My personal favorite is MySQL but I guess it's because I've used it more times than the two other ones. Link to comment
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