Hi have a strange problem with PHP and MySql connection.
I m using PHP 7.1.2 and MySql v5.5.64
Now I write the following code:
<?php
$mysqli = new mysqli("localhost", "usr_gest", "qo2f", "db_gest");
if ($mysqli->connect_errno) {
echo "Connessione a MySQL fallita: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error;
}
echo $mysqli->host_info . "n";
$mysqli = new mysqli("localhost", "usr_gest", "qo2f", "db_gest", 3306);
if ($mysqli->connect_errno) {
echo "Connessione a MySQL2 fallita: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error;
}
echo $mysqli->host_info . "n";
$sql = "SELECT * FROM login";
if ($mysqli->query($sql) === TRUE) {
echo "success";
} else {
echo "Error creating table: " . $mysqli->error;
}
$sql = "SELECT * FROM login;";
if ($mysqli->query($sql) === TRUE) {
echo "success";
} else {
echo "Error creating table: " . $mysqli->error;
}
$mysqli->close();
?>
If I try to open the page with this code I can see this:
Localhost via UNIX socket
Localhost via UNIX socket
Error select table1:
Error select table2:
How can I fixed this error?
In my mysql database there is “login” table