diff --git a/docroot/html/mysql.php b/docroot/html/mysql.php index 64b8611..d61c3b9 100644 --- a/docroot/html/mysql.php +++ b/docroot/html/mysql.php @@ -1,19 +1,32 @@ + clear + - -
+ clearprepare( + "INSERT INTO customers (customer_id, name, email) VALUES (NULL, ?, ?)" + ); + $add_customer->bind_param('ss', $_POST["name"], $_POST["email"]); + $result = $add_customer->execute(); + + if (!$result) { + ?>Creating tables...
query("DROP TABLE IF EXISTS customers"); + $create_result = $MYSQLCONN->query(" + 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 + "); - ?>+ if (!$create_result) { + printf("Failed to create tables: %s\n", $MYSQLCONN->error); + } else { + printf("%d Row inserted.\n", $MYSQLCONN->affected_rows); + print_r($MYSQLCONN->query("DESCRIBE customers")); + print_r($MYSQLCONN->query("SELECT * FROM customers")); + } -
Failed to create customer!: error ?>
affected_rows; ?> Row inserted.
- + + + +query("SELECT * FROM customers"); + while ($row = $results->fetch_array(MYSQLI_ASSOC)) { + print_r($row); + } + ?>+