Link to home
Start Free TrialLog in
Avatar of MrTV
MrTVFlag for Thailand

asked on

php mysql stock deduction

when user order  a pro duct I prepaire the order like the picture below  but how can i deduct the product from ' product ' table
if some item order more than I have on stock i must let user correct the quantity that they want until it fit my stock that i have

Please suggest php or sqlstate ment
CREATE TABLE IF NOT EXISTS `product` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `ProductId` varchar(80) DEFAULT NULL,
  `ProductName` varchar(255) DEFAULT NULL,
  `ProductType` varchar(255) DEFAULT NULL,
  `ProductPrice` varchar(255) DEFAULT NULL,
  `ProductQuantity` varchar(255) DEFAULT NULL,
  `DateTime` datetime DEFAULT NULL,
  `TimeStamp` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  UNIQUE KEY `ProductId` (`ProductId`),
  KEY `ProductId_2` (`ProductId`),
  KEY `ProductName` (`ProductName`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=7 ;

Open in new window

new.JPG
ASKER CERTIFIED SOLUTION
Avatar of igni7e
igni7e
Flag of Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Avatar of leakim971
leakim971
Flag of Guadeloupe image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks for the points!