#Connect MySQL from Unity
1 messages · Page 1 of 1 (latest)
I know
So you have ID/PW then what is your concern?
Of course you’d need read only access ID for client
Or create web server
my concern is I have no experience with PHP or MySQL and I've looked through a bunch of tutorials and cant figure this out
Ah then why not use something easier
I think Firebase Database can do something like that
i've already set up the MySQL databse. I can figure this out. The issue is just I've seen and tried so many tutorials and I don't know best practice
I don't wanna build a whole user/pw high score board like all these tutorials
You could use single hardcoded ID/PW with read permission for all client if that is the case
i'm most looking for the optimal tutorial to walk me through the process right now.
I don’t know your environment
You want to create PHP web server connecto to MySQL and retrieve the value that I understand?
yep
Well let’s see I think you need to reference ‘display.php’ part and customize query
You don’t need to add score or anything
yeah I can change all the top stuff fine. the try catch is the connecting part.
I dont get whats happening starting with $sth and below. is that part pulling the top 5 scores so i just cut all of it
Yeah you can just limit 1 if you want one result associated with request value
one row but ~20 fields from the row
And you can make it to json with json_encode and echo to return?
So it would be single page and request body with value from client
Returns json object of your row
That’s pretty much it I think
i'm trying to look up these things your saying
idk this is what my data looks like. probably?
yes I think json_encode will do what I need if it can find the right row
So select with limit 1 then echo the json encoded row and exit
And others are up to client
from square one: you think I shoudl write a PHP file, put it on my website. The top area with user and host stuff explains user and pw to the MySQL database. That one file is all I need and I need to edit that file you shared above to now just have that json_encode statement?
Yes that is what I think. If your server set up correctly to process php
ok thanks. wish me luck!
I wish you a good luck
It won’t be so hard to test since it’s readonly and all
thanks. it's 3am here i'm going to bed and trying again tomorrow morning.
i'll get it though 🙂
You will! Have a good rest