Home > database >  Connection failure: Unknown database 'gantt is what's going on
Connection failure: Unknown database 'gantt is what's going on

Time:10-27

Database name is gantt, can't be wrong, why even not at all, the couple,

run after tip: Unknown database 'gantt'
database name: gantt
code is as follows:
<? PHP
Echo "& lt; H1 & gt; Try the database can not be connected in & lt;/h1 & gt;
";
$servername="localhost";
$username="root";
$password="123456";
$dbname="gantt";

$conn=new mysqli ($servername, $username, $password, $dbname);

//test connection
If ($conn - & gt; Connect_error) {
Die (" connection: ". $conn - & gt; Connect_error);
}
Echo "& lt; The h2 & gt; The connection is successful & lt;/h2 & gt; ";


$SQL="SELECT id, text, FROM gantt_tasks";
$result=$conn - & gt; The query ($SQL);

If ($result - & gt; Num_rows & gt; 0 {
//output data
While ($row=$result - & gt; Fetch_assoc ()) {
Echo "id:". $row [" id "]. "- the Name:". $row [" text "] "& lt; Br> ";
}
} else {
Echo "0 results";
}
$conn - & gt; Close ();


?>

CodePudding user response:

Does not create or writing is wrong
  • Related