connect_error) { echo 4004; // Unsuccessful connection to database } } else { // Connection variables not set echo 4005; // Respond with bad request code } return $conn; */ } // Closes the connection to the database function db_close($conn) { $conn->close(); } // Run query with a return function db_query_return($inDatabase, $inQuery) { if(!$recordSet = mysqli_query($inDatabase, $inQuery)) { throw new Exception(mysqli_errno($inDatabase) . ": " . mysqli_error($inDatabase)); } return $recordSet; } // Run query without any return function db_query_no_return($inDatabase, $inQuery) { if(!mysqli_query($inDatabase, $inQuery)) { throw new Exception(mysqli_errno($inDatabase) . ": " . mysqli_error($inDatabase)); } } ?>