Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- error_reporting(E_ALL);
- ini_set('display_errors', 1);
- $server = 'localhost';
- $username = 'root';
- $password = '';
- $db = 'statusDB';
- try {
- $connection = new mysqli($server, $username, $password);
- if ($connection->connect_error) {
- throw new Exception('booboo 1');
- }
- $q = 'CREATE DATABASE IF NOT EXISTS ' . $db;
- if (!$connection->query($q)) {
- throw new Exception('booboo 2');
- }
- if (!$connection->select_db($db)) {
- throw new Exception('booboo 3');
- }
- $q2 = 'CREATE TABLE IF NOT EXISTS status (
- code INT(4) AUTO_INCREMENT PRIMARY KEY NOT NULL,
- date DATE NOT NULL,
- status VARCHAR(512) NOT NULL,
- sharePublic BOOLEAN,
- shareFriends BOOLEAN,
- shareMe BOOLEAN,
- allowLike BOOLEAN,
- allowComment BOOLEAN,
- allowShare BOOLEAN)';
- if (!$connection->query($q2)) {
- throw new Exception('booboo 4');
- }
- print "weeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee\n";
- } catch(Exception $e) {
- printf("i made a booboo: %s\n", $e->getMessage());
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement