i want to make page login and
i want to connet my database
$koneksi = mysql_connect(“localhost”,“id227xx_xxxx”,“xxxx”)
Can any one explain to “localhost” should i replace with what?
when i see in my database
db name : idx271xx_xx
DB User : idxxx_inxx
DB Host : localhost ???
Fixed localhost or replaced with what?
thanks #newbie
Localhost is correct/
You should add
$db = mysql_select_db(‘id227xx_xxxx’);
but why when i change the db host with my code with localhost ,is not work ?
$host = “localhost”;$user = “root”;$pass = “”;$dbname = “login”;
it’s example my code , when i change host with localhost , no working / error
Which version of php are you using?
in my account Current version: PHP 7.1
Okay, try out this code:
<?php
$link = mysqli_connect("localhost", "my_user", "my_password", "my_db");
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!" . PHP_EOL;
echo "Host information: " . mysqli_get_host_info($link) . PHP_EOL;
mysqli_close($link);
?>
Replace my_user, my_password and my_db with the correct information.
oke thank’s It is resolved ,
No problem
Any issue you face, please do open a new topic or PM any moderator