Basic example of a MySQL connection using mysqli on Linux.
/* Connect to a MySQL database */
/* MySQL info */
$server = 'localhost';
$db = 'my_database';
$user = 'my_user';
$pass = 'my_password';
/* Connect */
$mysqli = new mysqli($server, $user, $pass, $db) or die ("Could not connect: " . mysqli_connect_error());
/* Run query */
/* Yes this is a fictional query, no such database exists on this website ;) */
/* Fetch all IP's from the visitors table where IP matches the attempts in the bruteforce table and attempts is higher then 10 */
$result = $mysqli->query("SELECT * FROM bruteforce INNER JOIN visitors ON visitors.ipv4=bruteforce.ipv4");
/* Show results */
foreach ($result as $row) {
echo " Visitor's IP = " . $row['ipv4'] . "\t" .
" Login attempts = " . $row['tries'] . "\t" .
" Visitor country = " . $row['country'] . "\n";
}