These code files (itemList.php & itemEdit.php) are for "add item" function of an inventory module of a larger web based school ERP. The add item function primarily does the following.
(both these files reside in the folder "item" in the root folder.
1. creates a horizontal form to add item to the inventory with three fields e.g "name" "item category(drop down menu)" & "item description" (from top to bottom).
2. creates a general form with the column headers "name" "category" & "action"
3. under action ( edit & delete) options.
Now the issue is (1) , (2) (3 only delete) are being executed correctly but when it comes to "edit item", always the last added item is getting edited no matter which item i try to edit.
Both itemList.php & itemEdit.php have been attached along with complete database.php
DATA BASE (INVENTORY MODULE ONLY)
--
-- Table structure for table `item` (applications ---> controllers ---> install ---> database}
--
CREATE TABLE `item` (
`id` int(11) NOT NULL,
`item_category_id` int(11) DEFAULT NULL,
`name` varchar(255) NOT NULL,
`item_photo` varchar(225) DEFAULT NULL,
`description` text NOT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
`item_store_id` int(11) DEFAULT NULL,
`item_supplier_id` int(11) DEFAULT NULL,
`quantity` int(100) NOT NULL,
`date` date NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Table structure for table `item_category`
--
CREATE TABLE `item_category` (
`id` int(255) NOT NULL,
`item_category` varchar(255) NOT NULL,
`is_active` varchar(255) NOT NULL DEFAULT 'yes',
`description` varchar(255) NOT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00'
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Table structure for table `item_issue`
--
CREATE TABLE `item_issue` (
`id` int(11) NOT NULL,
`issue_type` varchar(15) DEFAULT NULL,
`issue_to` varchar(100) DEFAULT NULL,
`issue_by` varchar(100) DEFAULT NULL,
`issue_date` date DEFAULT NULL,
`return_date` date DEFAULT NULL,
`item_category_id` int(11) DEFAULT NULL,
`item_id` int(11) DEFAULT NULL,
`quantity` int(10) NOT NULL,
`note` text NOT NULL,
`is_returned` int(2) NOT NULL DEFAULT '1',
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`is_active` varchar(10) DEFAULT 'no'
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Table structure for table `item_stock`
--
CREATE TABLE `item_stock` (
`id` int(11) NOT NULL,
`item_id` int(11) DEFAULT NULL,
`supplier_id` int(11) DEFAULT NULL,
`symbol` varchar(10) NOT NULL DEFAULT '+',
`store_id` int(11) DEFAULT NULL,
`quantity` int(11) DEFAULT NULL,
`date` date NOT NULL,
`attachment` varchar(250) DEFAULT NULL,
`description` text NOT NULL,
`is_active` varchar(10) DEFAULT 'yes',
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Table structure for table `item_store`
--
CREATE TABLE `item_store` (
`id` int(255) NOT NULL,
`item_store` varchar(255) NOT NULL,
`code` varchar(255) NOT NULL,
`description` text NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Table structure for table `item_supplier`
--
CREATE TABLE `item_supplier` (
`id` int(255) NOT NULL,
`item_supplier` varchar(255) NOT NULL,
`phone` varchar(255) NOT NULL,
`email` varchar(255) NOT NULL,
`address` varchar(255) NOT NULL,
`contact_person_name` varchar(255) NOT NULL,
`contact_person_phone` varchar(255) NOT NULL,
`contact_person_email` varchar(255) NOT NULL,
`description` text NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
itemEdit.php
itemEdit.php
itemList.php
database.sql