Initial commit
This commit is contained in:
Vendored
+22
@@ -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
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
function get_category_items($db)
|
||||||
|
{
|
||||||
|
return mysqli_query($db, "SELECT * FROM `category`");
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
@@ -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));
|
||||||
|
?>
|
||||||
@@ -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>
|
||||||
Reference in New Issue
Block a user