Added a class to retrieve the basic item information data.
This commit is contained in:
+19
-2
@@ -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();
|
||||
}
|
||||
?>
|
||||
@@ -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));
|
||||
?>
|
||||
@@ -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;
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user