Jump to content

[REQUEST]MYSQL


Recommended Posts

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

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

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...