Ich kriege die ganze Zeit diesen Fehler in php: PHP Fatal error: Uncaught mysqli_sql_exception: Table 'gban.gban_location' doesn't exist in C:\inetpub\wwwroot\bans\database\queries.php:36
Code:
<?php
function getDatabase() {
// Values
global $hostname, $username, $password, $database, $port;
// Connection
$connection = new mysqli($hostname, $username, $password);
$database_sql = "CREATE DATABASE IF NOT EXISTS `" . $database . "`";
// Check
if ($connection -> connect_error) {
die("[Bans] Database connection has failed, " . mysqli_connect_error());
}
// Create database
if ($connection -> query($database_sql) == TRUE) {
} else {
echo "[Bans] Database has not been created, error: " . $connection -> error;
}
//Set to UTF8 to allow none english characters
if (!$connection->set_charset("utf8")) {
printf("Error loading character set utf8: %s\n", $connection->error);
exit();
}
Frage
Zugriff
Hallo,
Ich kriege die ganze Zeit diesen Fehler in php: PHP Fatal error: Uncaught mysqli_sql_exception: Table 'gban.gban_location' doesn't exist in C:\inetpub\wwwroot\bans\database\queries.php:36
Code:
<?php
function getDatabase() {
// Values
global $hostname, $username, $password, $database, $port;
// Connection
$connection = new mysqli($hostname, $username, $password);
$database_sql = "CREATE DATABASE IF NOT EXISTS `" . $database . "`";
// Check
if ($connection -> connect_error) {
die("[Bans] Database connection has failed, " . mysqli_connect_error());
}
// Create database
if ($connection -> query($database_sql) == TRUE) {
} else {
echo "[Bans] Database has not been created, error: " . $connection -> error;
}
//Set to UTF8 to allow none english characters
if (!$connection->set_charset("utf8")) {
printf("Error loading character set utf8: %s\n", $connection->error);
exit();
}
// Set database
mysqli_select_db($connection, $database);
// Return connection object
return $connection;
}
function runQuery($query) {
// Get object
$database_object = getDatabase();
// Try the query
$callback = $database_object -> query($query);
// Check
if ($callback == FALSE) {
return NULL;
}
Könnte mir jemand weiter helfen?
Danke schon mal im voraus. :D
9 Antworten auf diese Frage
Empfohlene Beiträge
Dein Kommentar
Du kannst jetzt schreiben und Dich später registrieren. Wenn Du ein Konto hast, melde Dich jetzt an, um unter Deinem Benutzernamen zu schreiben.