I am new to PHP and I`m using eclipse SDE to build a simple web application.
My Scenario is:
Make file connection.php with all that have tangence with mysql connection and after ad in each file where you use mysql query the line include_once('connection.php');
or you can have include_once('some_folder\connection.php');
If you are beginner you can use this mode to connect to DB
mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
$link = mysqli_connect('localhost', 'mysql_user', 'mysql_password');
echo 'Connected successfully';
$res = mysqli_query($link, "CREATE TEMPORARY TABLE myCity LIKE City");
http://php.net/manual/en/mysqli.query.php