Author Topic: Torque Connecting To MySQL  (Read 764 times)

I read a post on this but i wasn't sure how exactly they were doing this. I need some way of making a database for my server. I have experience in PHP and MySQL Database, just not very good with torque engine. Would this be extremely hard to accomplish?

TorqueScript has no MySQL interface (it's possible to code from what I've read of the MySQL protocol, but it'd be a stuff load of work) so you have to use a dynamic web page to access MySQL via TorqueScript. PHP is most commonly used.

You'd code the PHP script for accessing the database based on the get parameters or posted parameters. Once you've got a working web page, you need to communicate from TorqueScript using TCP objects or HTTP objects. There's plenty of resources on this in coding help already, or RTB, so take a look around.

The hardest part is security. If this is going to be a released add-on you need to make sure there's no way to extract private data. If what you want to do is actually post data to be added to the database in an add-on that will be released, then it's a horribly bad idea because there is basically no clean way to have the data not be false, so people would just spam your database with useless stuff and break things. If it's not going to be released, posting data is fine.

the proper way to do this is to make changes to the C++ code and link in the MYSQL DLL files.  Im sure theres resources on garagegames.com explaining how to do this.

But since Badspot doesnt give out the source code to blockland, its not going to happen.

Ok yea seems like a lot more work than needed. So is there another way of making a database for my server? This database will hold blockland names, ids, scores, etc.

Store it in your Blockland folder using file objects.