- Home /
Logging in to a mysql database
Is it possible to connect to a mysql database and check if the user has bought the game?
Update: What is the client side code to do this?
Answer by Graham-Dunnett · Jun 08, 2013 at 09:21 PM
Yes. Use WWWForm
to make a request to your web server passing some details of the user. You'll probably have a PHP script on the server which will call into your database.
Answer by xKroniK13x · Jun 08, 2013 at 09:55 PM
Yes, as Graham said, you will call into a PHP script on your website. On the form you will need username and password. I'd suggest an encryption method of some sort, but that's not required. You have the user type in their username/password in unity, post it to the PHP script... the php script queries the database for the username, makes sure the name matches the password, and then you can output information. I always output the information I need into JSON format. Yield the www
form so that it waits for the download, and use www.text
to retrieve the outcome of the php file.
Your answer
![](https://koobas.hobune.stream/wayback/20220613103806im_/https://answers.unity.com/themes/thub/images/avi.jpg)