Jump to content

Recommended Posts

Posted

I got an Error in my Code that:

0 results: : Table 'ccraft50_db.MyGuests_Index' doesn't exist

 

This is my code:

 

<?php
$servername = "localhost";
$username = "ccraft50_db";
$password = "my password";
$dbname = "ccraft50_db";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
   die("Connection failed: " . $conn->connect_error);
}
$sql = "SELECT id, firstname, lastname FROM MyGuests";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
   // output data of each row
   while($row = $result->fetch_assoc()) {
    echo "id: " . $row["id"]. " - Name: " . $row["firstname"]. " " . $row["lastname"]. "<br>";
   }
} else {
   echo "0 results: " . $conn->error;
}
$conn->close();
?>

 

How do I remove the database name in my Table?

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...