Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
692 views
in Technique[技术] by (71.8m points)

php - Error: SELECT COUNT(*) FROM information_schema.tables WHERE table_schema = 'id15811100_bus' AND table_name = 'another_test'

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; 
?>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
...