How to start php connection to MySQL

I am totally new to using server. I set up a database using phpMyAdmin. And I’d like to write a php program, save somewhere here and test how it works with the database. But I have no idea how to start and where to save php programs. What I want to test is to handle the database from my app (on the smartphone).
Can someone help me on this? I’m sorry for the very basic question.

@TankUserDavid You can try this,

You can find database related details by going to “Manage Database” Tab.

Thanks for your reply.
I guess the sentence in your comment should be the start in php, right?
My question is more basic - where in 000webhost should I put my php program to be performed by http connection?

Yes before your actual program starts.

Place your files in “public_html”.
Log in to File Manager and upload your files.

You can find FTP login details by going to “Settings” – "General"
If your don’t know the password then reset it,
“Settings” – “General” – “FTP Password”

I will try that. Thank you so much !!!

1 Like

Any issue do post :slight_smile: i’ll leave this topic open.

I’m sorry to keep asking basic questions.

1- It is always localhost
2- Nope, it is yourwebsite.000webhostapp.com/my.php

I got an error on unity editor saying UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr).
It seems something wrong with my php source. Can I see the error details anywhere in phpMyAdmin?

Can you post screenshot of your issue??

For now, I got nothing to show you. I ran a Unity program accessing a database in 000webhost.
And that error came out. This is my Unity source.

private string urlSave = “http://vuniverse.000webhost.com/save.score.php”;

void Awake () {
	instance = this;
}

public IEnumerator SaveScore(string user_name, int kill_count) {
	WWWForm form = new WWWForm();
	form.AddField("user_name", user_name);
	form.AddField("kill_count", kill_count);
	form.AddField("seq_no", seqNo);

	var www = new WWW(urlSave, form);

	yield return www;

	if (string.IsNullOrEmpty(www.error)) {
		Debug.Log(www.text);
	} else {
		Debug.Log("Error : " + www.error); <======
	}
}

That line shows the error.

It’s OK for me that you look at my php source, if possible.

How can I directly test php programs?
http://mywebsite.000webhost.com/my.php’ would work?

Yes, your visitors won’t see https://mywebsite.000webhost.com/public_html/my.php
They will see instead:
https://mywebsite.000webhost.com/my.php
In other words, to test your website, you won’t use public_html in the url :wink:

I made it finally^^. I may need to study more about php.
Thank you for all your help.

1 Like