esporta05 Posted July 28, 2014 Share Posted July 28, 2014 Hi all, Well there is a cool MYSQL tutorial for establishing connections but I can't find a tutorial for sending/retrieving datas from MYSQL database. If someone can make a tutorial for sending and receiving datas from database that will be really cool. Simple stuffs like sending a variable to there and outputting it. Just for teaching us how to send and receive data from MYSQL database Link to comment
_DrXenon Posted July 28, 2014 Share Posted July 28, 2014 make a table like: local sql = { executeSQLQuery }; at first or even use it like that local sql = { query = executeSQLQuery }; then to send data use: sql.query("INSERT INTO sqlName(firstarg[,secondarg,thirdarg,...,...]) VALUES ("..firstVariable..","..second..")") then to receiver use: sql.query("SELECT firstarg FROM sqlName WHERE = ?",where) when using "?" in the SQL String, you gotta answer it after the string. like: sql.query("SELECT wantedLevel FROM players WHERE = ?",getPlayerName(thePlayer)) Of course you can send nor receive if you didn't create the SQL table aleady... to create one use: sql.query("CREATE TABLE IF NOT EXISTS sqlName(firstarg INT,second TEXT,third REAL,... TEXT,... TEXT)" TEXT, INT or REAL presents the type of the argument... if text INT then this argument should only filled with INTs not Floats REAL = Any real number. TEXT = text value.. to insert a text value to sql table use: sql.query("INSERT INTO sqlName("firstarg,second,third,....,...) VALUES ("..variable..",' "..theTEXT" ',"..third..")") as we created the table with second argument as text then when inserting a value for the second argument use ' ' Anyway.. Anybody may fix me for any wrongs...or mistakes as i am also new for SQL Thingy.. Link to comment
Bonsai Posted July 28, 2014 Share Posted July 28, 2014 You shouldn't use MYSQL for MTA. The internal database system works just fine. Link to comment
Karuzo Posted July 28, 2014 Share Posted July 28, 2014 Everyone has it's own method. I prefer to use MySQL. Link to comment
esporta05 Posted July 29, 2014 Author Share Posted July 29, 2014 I dont understand it. Can you please explain them with much easier examples? If you explain things step by step with lua bbcode that will be much more easier. If you can create a topic for this tutorial this will be much more better. 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