I have created a connection to the database, MySQL, using PHP. But I get the error->
Error: SELECT COUNT(*) FROM information_schema.tables WHERE table_schema = 'id15811100_bus' AND table_name = 'another_test'
<?php
ob_start();
//echo "hi". "<br>";
$servername = "localhost";
$username = "id15811100_bus_admin";
$password = "Rat007pry163#";
mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
// Create connection
$conn = new mysqli($servername, $username, $password);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$w = "USE id15811100_bus";
if ($conn->query($w) === TRUE) {
//echo "database used successfully". "<br>";
} else {
echo "Error: " . $sql . "<br>" . $conn->error;
}
$sql ="SELECT COUNT(*)
FROM information_schema.tables
WHERE table_schema = 'id15811100_bus'
AND table_name = 'another_test'";
$result = $conn->query($sql);
echo $result->num_rows;
?>
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…