<!DOCTYPE html>
<html>
<body>
<?php
$conn = mysqli_connect("localhost", "dev", "dev");
if (mysqli_connect_errno()) {
die("Internal error: connection to DB failed ".
mysqli_connect_error());
}
if (!mysqli_select_db($conn, "database")) {
die("Internal error: selection of DB failed");
}
$sql = "SELECT * FROM Person";
$result = mysqli_query($conn, $sql);
if (mysqli_num_rows($result) > 0) {
// output data of each row
while($row = mysqli_fetch_assoc($result)) {
echo "<br> id: ". $row["id"]. " - Name: ". $row["name"]. " " . $row["surname"] . "<br>";
}
} else {
echo "0 results";
}
?>
</body>
</html>
I can't access to the database. It's strange because trying to access to DB from DataGrip or other software with same credentials works. I'm using MySQL5.7 and i have also try to using the port 13306 in the host part...
Using this code:
I can't access to the database. It's strange because trying to access to DB from DataGrip or other software with same credentials works. I'm using MySQL5.7 and i have also try to using the port 13306 in the host part...
Any help?