MySQL help

hello,

first of all i’d like to say thank you for reading this.
i’ve been trying to get into the Mysql part of lua but i kinda got stuck…
i THINK i actually get the basics of the sql “stuff” but the only problem i have so far… HOW do i link my server actually to the lua part of gmod? i read quincy’s tutorial about sql which helped alot yet it did NOT explain my problem…
i hope someone can help me.

thanks in advance and a happy new year.

-Hans

You would need an SQL module such as gmsv_mysql.

yeah i kinda know that much from cider long ago, which is why i ended up getting mysqlOO by : Andy Vincent
but more or less what i mean, is like usualy u got to setup a server, right?
ip,port,database,username,password

how should i do this, and do i need to write something special for it in every lua file so they call to the rightserver or is it just global like a include or what ever?

(i got beyond rusty from a large lua break so sorry for some of my stupid questions, but i rather ask now a stupid question than get stuck somewhere 5 minutes after someone is kind enough to help me haha.)

Personally, I dont use MySQLoo , but tMySQL , and this is how you use that :

tmysql.initialize(DATABASE_HOST, DATABASE_USERNAME, DATABASE_PASSWORD, DATABASE_NAME, DATABASE_PORT)

This tutorial was written for Andy Vincent’s MySQL module.

@ james, how come you don’t like mysqloo? and what’s the difference between mysqloo and tmysql?

@ penerlord, thanks i kinda browsed trough it aswell but i get errors while the tests like table test.test doesnt exist even if i make the table myself, which is why i though maybe it dint work anymore/needed to be updated.

anyway, thanks both of you.

I don’t like that tutorial, because the code given wouldn’t work AFAIK if you were to run it.

Hans what exactly are you trying to do – end result?

DarkRP uses this mysql module, too. You could have a look at this.

@zzaacckk

ehm, i’m trying to sort of make a script so joined players will be logged into a sql database with certain other other things like steamID , rank, donator and shit like that

and several other things that depends on those things it reads from the sql database, like if they’re donator rank X -> special icon in scoreboard or something like it.

kinda the usual basic “crap”

@pennerlord

yes but isnt that “sql light” or what the name may be (write to text files) which are saved on ur server( if i remember right from long ago in the data folder.)

i kind of wish to make several servers connect to 1 database so you get shared stuff.

people: sorry in advance for my horrible writing, newyears eve here, so yeah… you probably get it.
but, thanks alot again for all the help!

It provides both: Sqlite and MySQL.

o-o seriously? awesome i’m more or less from the old dark rp so is it a new feature?

well, i’m gonne try some stuff out again… i keep having this feeling i forget something.

Don’t know. Probably there for about 2 years (more or less).

heh… i din’t know that all i remember was sqlite if i remember right, but i din’t touch dark rp in a long time so yeah… guess i’ll go take a look at it it might be helpfull and than maybe sleep…

thanks man.

edit: <burning facepalm of pain> i finaly figured out what the hell went wrong… i actually just missed 1 table… xD great thing 'bout not knowing st 'bout sql and trying st xD i din’t understand the errors at all… (yes yes i probably should have posted them i know it’s my bad hehe…)

well… everything works fine now X_X did not expect it to work this well.

anyway, probably around now most of u already changed year so happy newyear probably, if you’re chineese < in 1-2 months

well, thanks once again to you two! and have a nice day.