Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- //CREATE CONNECTION
- $servername = "localhost";
- $username = "root";
- $password = "root";
- $conn = new mysqli($servername, $username, $password);
- // CHECK THE CONNECTION
- if ($conn->connect_error) {
- die("Connection failed: " . $conn->connect_error);
- }
- // CREATE ESTATE AGENTS DATABASE
- $sql = "CREATE DATABASE IF NOT EXISTS estate_agents";
- if ($conn->query($sql) === TRUE) {
- $dbname= "estate_agents";
- $newConnection = new mysqli($servername, $username, $password,$dbname);
- //CREATE PROPERTIES TABLE
- $sql = "CREATE TABLE IF NOT EXISTS properties (
- property_id INT(6) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
- property_name VARCHAR(50) NOT NULL,
- property_cost VARCHAR(50) NOT NULL,
- property_description VARCHAR(500) NOT NULL
- )";
- if ( $newConnection->query($sql) === TRUE) {
- }
- else {
- echo "Error creating table: " . $newConnection->error . "</br>";
- }
- }
- else {
- echo "estate_agents not functional: " . $newConnection->error . "</br>";
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement