getMessage()); exit(); } $ACTION = ""; if (array_key_exists("action", $_POST)) { $ACTION = $_POST["action"]; } require_once("_head.php"); function show_clear_link() { ?> clear

Creating tables...

exec("DROP TABLE IF EXISTS customers");

        try {
            $nrows = $PDOCONN->exec("
                CREATE TABLE customers (
                    customer_id MEDIUMINT NOT NULL AUTO_INCREMENT,
                    name VARCHAR(255) NOT NULL,
                    email VARCHAR(255) NOT NULL,
                    PRIMARY KEY(customer_id)
                ) ENGINE=InnoDB
            ");

            printf("%d Row inserted.\n", $nrows);

        } catch (PDOException $e) {
            printf("Failed to create tables: \n%s\n", $e->getMessage());
        }

        ?>
prepare( "INSERT INTO customers (customer_id, name, email) VALUES (NULL, :name, :email)" ); $add_customer->bindParam(':name', $_POST["name"], PDO::PARAM_STR, 12); $add_customer->bindParam(':email', $_POST["email"], PDO::PARAM_STR, 12); $nrows = $add_customer->execute(); ?>

Row inserted.

Failed to create customer!: getMessage() ?>

Database Admin
Add Customer
query("SELECT * FROM customers");
            while ($row = $results->fetchAll()) {
                print_r($row);
            }
        ?>