Connecting to mysql via php.
<?php $servername = "hostname"; $username = "username"; $password = "password"; $dbname = "database"; $loggedin = false; $conn = new mysqli($servername, $username, $password, $dbname); if ($conn->connect_error) { //handle it } ?>
this is nice to keep in a separate file (inc/conn.php) which can be included into other pages via;
require_once 'inc/conn.php';