File manager - Edit - /home/wwwroot/camplus.hk/master.camplus.hk/public_html/install/includes/Database_class.php
Back
<?php class Database { // Function to the database and tables and fill them with the default data function create_database($data) { // Connect to the database $mysqli = new mysqli($data['hostname'],$data['username'],$data['password'],''); // Check for errors if(mysqli_connect_errno()) return false; // Create the prepared statement $mysqli->query("CREATE DATABASE IF NOT EXISTS ".$data['database']); // Close the connection $mysqli->close(); return true; } // Function to create the tables and fill them with the default data function create_tables($data) { // Connect to the database $mysqli = new mysqli($data['hostname'],$data['username'],$data['password'],$data['database']); // Check for errors if(mysqli_connect_errno()) return false; // Open the default SQL file $query = file_get_contents('db/install.sql'); // Execute a multi query if ($mysqli->multi_query($query)) { do { /* store first result set */ if ($result = $mysqli->store_result()) { while ($row = $result->fetch_row()) { //printf("%s\n", $row[0]); } $result->free(); } /* print divider */ if ($mysqli->more_results()) { //printf("-----------------\n"); } } while ($mysqli->next_result()); } // Close the connection $mysqli->close(); return true; } }
| ver. 1.4 |
Github
|
.
| PHP 7.2.34 | Generation time: 0.14 |
proxy
|
phpinfo
|
Settings