Initial commit

This commit is contained in:
2020-03-30 22:03:06 -05:00
commit 353a663501
4 changed files with 70 additions and 0 deletions
+22
View File
@@ -0,0 +1,22 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Listen for XDebug",
"type": "php",
"request": "launch",
"port": 9000
},
{
"name": "Launch currently open script",
"type": "php",
"request": "launch",
"program": "${file}",
"cwd": "${fileDirname}",
"port": 9000
}
]
}
+8
View File
@@ -0,0 +1,8 @@
<?php
function get_category_items($db)
{
return mysqli_query($db, "SELECT * FROM `category`");
}
?>
+9
View File
@@ -0,0 +1,9 @@
<?php
$host = '127.0.0.1:3306';
$user_name = 'root';
$password = '1a9t7y';
$db_name = 'inventory';
$db = mysqli_connect($host, $user_name, $password, $db_name) or die("Failed to
connect to MySQL: " . mysqli_error($db));
?>
Executable
+31
View File
@@ -0,0 +1,31 @@
<?php
include_once "db/db.php";
include_once "db/category.php";
$categories = get_category_items($db);
if($categories){
if($categories->num_rows == 0){
header("Location: create_category.php");
exit(); //It's good practice to call exit() after a redirect so nothing else gets executed.
}
while($row = mysqli_fetch_array($categories))
{
}
}
else{
echo "Error";
}
$db->close();
?>
<html>
<head>
</head>
<body>
</body>
</html>