webmaster@1: = 2000 || mysqli_connect_errno() == 1045) { webmaster@1: drupal_set_message(st('Failed to connect to your MySQL database server. MySQL reports the following message: %error.For more help, see the Installation and upgrading handbook. If you are unsure what these terms mean you should probably contact your hosting provider.', array('%error' => mysqli_connect_error())), 'error'); webmaster@1: return FALSE; webmaster@1: } webmaster@1: webmaster@1: // Test selecting the database. webmaster@1: if (mysqli_connect_errno() > 0) { webmaster@1: drupal_set_message(st('Failed to select your database on your MySQL database server, which means the connection username and password are valid, but there is a problem accessing your data. MySQL reports the following message: %error.For more help, see the Installation and upgrading handbook. If you are unsure what these terms mean you should probably contact your hosting provider.', array('%error' => mysqli_connect_error())), 'error'); webmaster@1: return FALSE; webmaster@1: } webmaster@1: webmaster@1: $success = array('CONNECT'); webmaster@1: webmaster@1: // Test CREATE. webmaster@1: $query = 'CREATE TABLE drupal_install_test (id int NULL)'; webmaster@1: $result = mysqli_query($connection, $query); webmaster@1: if ($error = mysqli_error($connection)) { webmaster@1: drupal_set_message(st('Failed to create a test table on your MySQL database server with the command %query. MySQL reports the following message: %error.For more help, see the Installation and upgrading handbook. If you are unsure what these terms mean you should probably contact your hosting provider.', array('%query' => $query, '%error' => $error)), 'error'); webmaster@1: return FALSE; webmaster@1: } webmaster@1: $err = FALSE; webmaster@1: $success[] = 'SELECT'; webmaster@1: $success[] = 'CREATE'; webmaster@1: webmaster@1: // Test INSERT. webmaster@1: $query = 'INSERT INTO drupal_install_test (id) VALUES (1)'; webmaster@1: $result = mysqli_query($connection, $query); webmaster@1: if ($error = mysqli_error($connection)) { webmaster@1: drupal_set_message(st('Failed to insert a value into a test table on your MySQL database server. We tried inserting a value with the command %query and MySQL reported the following error: %error.', array('%query' => $query, '%error' => $error)), 'error'); webmaster@1: $err = TRUE; webmaster@1: } webmaster@1: else { webmaster@1: $success[] = 'INSERT'; webmaster@1: } webmaster@1: webmaster@1: // Test UPDATE. webmaster@1: $query = 'UPDATE drupal_install_test SET id = 2'; webmaster@1: $result = mysqli_query($connection, $query); webmaster@1: if ($error = mysqli_error($connection)) { webmaster@1: drupal_set_message(st('Failed to update a value in a test table on your MySQL database server. We tried updating a value with the command %query and MySQL reported the following error: %error.', array('%query' => $query, '%error' => $error)), 'error'); webmaster@1: $err = TRUE; webmaster@1: } webmaster@1: else { webmaster@1: $success[] = 'UPDATE'; webmaster@1: } webmaster@1: webmaster@1: // Test DELETE. webmaster@1: $query = 'DELETE FROM drupal_install_test'; webmaster@1: $result = mysqli_query($connection, $query); webmaster@1: if ($error = mysqli_error($connection)) { webmaster@1: drupal_set_message(st('Failed to delete a value from a test table on your MySQL database server. We tried deleting a value with the command %query and MySQL reported the following error: %error.', array('%query' => $query, '%error' => $error)), 'error'); webmaster@1: $err = TRUE; webmaster@1: } webmaster@1: else { webmaster@1: $success[] = 'DELETE'; webmaster@1: } webmaster@1: webmaster@1: // Test DROP. webmaster@1: $query = 'DROP TABLE drupal_install_test'; webmaster@1: $result = mysqli_query($connection, $query); webmaster@1: if ($error = mysqli_error($connection)) { webmaster@1: drupal_set_message(st('Failed to drop a test table from your MySQL database server. We tried dropping a table with the command %query and MySQL reported the following error %error.', array('%query' => $query, '%error' => $error)), 'error'); webmaster@1: $err = TRUE; webmaster@1: } webmaster@1: else { webmaster@1: $success[] = 'DROP'; webmaster@1: } webmaster@1: webmaster@1: if ($err) { webmaster@1: return FALSE; webmaster@1: } webmaster@1: webmaster@1: mysqli_close($connection); webmaster@1: return TRUE; webmaster@1: }