I wrote a simple user registration system that runs on my local machine using apache. (Localhost at port 8080).
My php file that tries to connect to mysql database looks like :
<?php
$con = mysqli_connect("localhost","root","","register");
//localhost will have to change to host name if hosted on different server... I think.
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
?>
Everything works and I can register/sign in a user on my local machine.
I know that I have to change $con = mysqli_connect("localhost","root","","register");
once I am ready to upload my site to host it in a free server like surge.sh or github pages.
I pushed my site to github pages from my repository and when I click "Register" / "Sign in" it doesn't load the page instead it acts as if I want to download the .php file. How should I make the changes? I need some help and suggestions.