Jump to content

SQL


Desaster

Recommended Posts

Posted

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

Posted (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 by Guest
Posted

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

Posted

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.

Posted

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.

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...