darkmist icon

mysqli_connect

darkmist | PRO | 11/13/16 07:51:37 PM UTC | 0 ⭐ | 168 👁️ | Never ⏰ | []
PHP |

560 B

|

None

|

0 👍

/

0 👎

<?php
// If using Docker, this code has been tested with "jorge07/alpine-php:7" image.
 
$link = mysqli_connect("107.170.222.199", "donstringham", "1234pass", "final");
 
if (!$link) {
    echo "Error: Unable to connect to MySQL." . PHP_EOL;
    echo "Debugging errno: " . mysqli_connect_errno() . PHP_EOL;
    echo "Debugging error: " . mysqli_connect_error() . PHP_EOL;
    exit;
}
 
echo "Success: A proper connection to MySQL was made! The database is great." . PHP_EOL;
echo "Host information: " . mysqli_get_host_info($link) . PHP_EOL;
 
mysqli_close($link);

Comments