I'm having troubles with my SQL, I can connect to SQL via Mamp and access Phpmyadmin, though when I try to display my database on browser with that code into my code editor:
<?php
$link = mysqli_connect("localhost:8000", "root", "password",
"Portfolio");
if (!$link) {
echo "Error: Unable to connect to MySQL." . PHP_EOL;
echo "Debugging error: " . mysqli_connect_errno() . PHP_EOL;
echo "Debugging error: " . mysqli_connect_error() . PHP_EOL;
exit;
}
echo "Success: A proper connection to MySQL was made! The Portfolio
database is great." . PHP_EOL;
echo "Host information: " . mysqli_get_host_info($link) . PHP_EOL;
mysqli_close($link);
?>
The browser indicates the message I wrote in my code, so a connection is made somewhere: Error: Unable to connect to MySQL. Debugging error: 2002 Debugging error: Connection refused
The url I enter everytime is : http://localhost:8888/bdd.php "bdd.php" being my file name.
This is getting me crazy, i've tried so many things (changing code with "path" on php init, reinstalling mamp, mysql..) and still have no idea of what's wrong, I began coding a few months ago and really need help on that one!
Cheers!