dugasz1 Posted September 21, 2016 Share Posted September 21, 2016 (edited) Hello guys. Recently i heard this thing that it's better if i use fetchRemote for saving data. So, if the client have to save something to the mysql database instead of trigger it to the server then it saves it with dbQuery/dbExec (then trigger back if it's a SELECT) it's better to use fetchRemote on the client and call a php script. (mta, php, mysql server are on the same host) What do you think about it? Edited September 21, 2016 by dugasz1 Link to comment
Bonsai Posted September 21, 2016 Share Posted September 21, 2016 I think if anyone should have something to save in the database, its the server, not the clients. You should probably try to have as less queries to the database as possible, by e.g. caching, or fetching at certain points only. Link to comment
dugasz1 Posted September 21, 2016 Author Share Posted September 21, 2016 I tought something like inventory for example. Player join he needs the data cache it in client side. After quit data need to be sended to the mysql server for save. But it's all in just theory. So which is the faster? And another question: Should i use one or more mysql connection? Link to comment
Bonsai Posted September 22, 2016 Share Posted September 22, 2016 I don't know if its faster but I doubt its good practice. Clients cannot save anything after they quit. Also what happens if they time out, everything will be lost. 1 Link to comment
MTA Team sbx320 Posted September 24, 2016 MTA Team Share Posted September 24, 2016 (edited) It'll generally be slower, due to the additional overhead of calling a php script, which then needs to do the same work as MTA would do using dbQuery. Also allowing the client to save data via a web request is a terrible idea, because you're opening your server to allowing any client to store any information in the database (as I could just go ahead and use my Browser to store data, rather than the MTA client). Edited September 24, 2016 by sbx320 1 Link to comment
dugasz1 Posted September 25, 2016 Author Share Posted September 25, 2016 Thank you for yours answere. I will avoid the http solution. And Bonsai answere makes a question in me. If i cache a data on client from mysql when it connects (because it will be used frequently ) then i should store this in element data? Not in a simple variable? So if the client lost connection then i can send the data to the mysql without the client? And which element should i use to store data? 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