Added a class to retrieve the basic item information data.

This commit is contained in:
2020-04-06 11:51:45 -05:00
parent 353a663501
commit 257d442f40
7 changed files with 79 additions and 23 deletions
+19 -2
View File
@@ -1,8 +1,25 @@
<?php
require "db.php";
function get_category_items($db)
function get_category_items()
{
return mysqli_query($db, "SELECT * FROM `category`");
global $conn;
$items = mysqli_query($conn, "SELECT * FROM `category`");
$conn->close();
return $items;
}
function create_category($name)
{
global $conn;
$statement = $conn->prepare("INSERT INTO `category` (category_name) VALUES (?)");
$statement->bind_param("s", $name);
if($statement->execute() == true){
}
$statement->close();
$conn->close();
}
?>
+2 -2
View File
@@ -4,6 +4,6 @@
$password = '1a9t7y';
$db_name = 'inventory';
$db = mysqli_connect($host, $user_name, $password, $db_name) or die("Failed to
connect to MySQL: " . mysqli_error($db));
$conn = mysqli_connect($host, $user_name, $password, $db_name) or die("Failed to
connect to MySQL: " . mysqli_error($conn));
?>
+14
View File
@@ -0,0 +1,14 @@
<?php
require "db.php";
function get_item_base_attributes(){
global $conn;
$query = "SELECT COLUMN_NAME
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_SCHEMA = 'inventory' AND TABLE_NAME = 'item_info';";
$data = mysqli_query($conn, $query);
$conn->close();
return $data;
}
?>