Updated theme handling and got the category form to clone rows.
This commit is contained in:
+2
-2
@@ -3,7 +3,7 @@
|
||||
|
||||
function get_category_items()
|
||||
{
|
||||
global $conn;
|
||||
$conn = get_db_connection();
|
||||
$items = mysqli_query($conn, "SELECT * FROM `category`");
|
||||
$conn->close();
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
function create_category($name)
|
||||
{
|
||||
global $conn;
|
||||
$conn = get_db_connection();
|
||||
$statement = $conn->prepare("INSERT INTO `category` (category_name) VALUES (?)");
|
||||
$statement->bind_param("s", $name);
|
||||
if($statement->execute() == true){
|
||||
|
||||
@@ -1,9 +1,23 @@
|
||||
<?php
|
||||
$host = '127.0.0.1:3306';
|
||||
$user_name = 'root';
|
||||
$password = '1a9t7y';
|
||||
$db_name = 'inventory';
|
||||
|
||||
$conn = mysqli_connect($host, $user_name, $password, $db_name) or die("Failed to
|
||||
connect to MySQL: " . mysqli_error($conn));
|
||||
function get_db_connection(){
|
||||
$host = '127.0.0.1:3306';
|
||||
$user_name = 'root';
|
||||
$password = '1a9t7y';
|
||||
$db_name = 'inventory';
|
||||
|
||||
$conn = mysqli_connect($host, $user_name, $password, $db_name) or die("Failed to
|
||||
connect to MySQL: " . mysqli_error($conn));
|
||||
|
||||
return $conn;
|
||||
}
|
||||
|
||||
function get_supported_data_types(){
|
||||
return [
|
||||
"date" => "Date",
|
||||
"money" => "money",
|
||||
"text" => "Long Description",
|
||||
"varchar" => "Short Text",
|
||||
"integer" => "Count"
|
||||
];
|
||||
}
|
||||
?>
|
||||
+10
-3
@@ -2,13 +2,20 @@
|
||||
require "db.php";
|
||||
|
||||
function get_item_base_attributes(){
|
||||
global $conn;
|
||||
$conn = get_db_connection();
|
||||
$rows = [];
|
||||
$query = "SELECT COLUMN_NAME
|
||||
FROM INFORMATION_SCHEMA.COLUMNS
|
||||
WHERE TABLE_SCHEMA = 'inventory' AND TABLE_NAME = 'item_info';";
|
||||
$data = mysqli_query($conn, $query);
|
||||
$data = mysqli_query($conn, $query);
|
||||
|
||||
while($row = mysqli_fetch_array($data)){
|
||||
$rows[] = str_replace("_", " ", $row["COLUMN_NAME"]);
|
||||
}
|
||||
|
||||
$data->free();
|
||||
$conn->close();
|
||||
|
||||
return $data;
|
||||
return $rows;
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user