59 lines
1.0 KiB
PHP
59 lines
1.0 KiB
PHP
<?php
|
|
|
|
$MYSQL_CXN = mysqli_connect(
|
|
"localhost",
|
|
"learningphp",
|
|
"learningphp",
|
|
"learningphp"
|
|
);
|
|
|
|
|
|
require_once("_head.php");
|
|
|
|
function create_all_tables($cxn) {
|
|
return @mysqli_query($cxn, file_get_contents("../setup.sql"));
|
|
};
|
|
|
|
|
|
mkheader("mysql!", '#aff');
|
|
|
|
?>
|
|
|
|
<body>
|
|
|
|
<!-- ======================================================= -->
|
|
<pre><?php
|
|
|
|
print "\$MYSQL_CXN:\n";
|
|
print_r($MYSQL_CXN);
|
|
|
|
?></pre>
|
|
|
|
<?php
|
|
|
|
if ($_POST['create'] == "yes") {
|
|
create_all_tables($MYSQL_CXN);
|
|
|
|
?>
|
|
<pre><?php
|
|
print_r(mysqli_query($MYSQL_CXN, "DESCRIBE customers"));
|
|
print_r(mysqli_query($MYSQL_CXN, "SELECT * FROM customers"));
|
|
|
|
?></pre><a href="<?php echo $_SERVER['PHP_SELF']; ?>">clear</a><?php
|
|
} else {
|
|
?>
|
|
|
|
<form name="setup" action="" method="POST">
|
|
<input type="hidden" name="create" value="yes" />
|
|
<input type="submit" name="submit" value="Create Tables" />
|
|
</form>
|
|
|
|
<?php
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
</body>
|
|
</html>
|