EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: kamaljvg on December 14, 2014, 12:09:00 PM



Title: How to update/delete a record from a table with multiple keys
Post by: kamaljvg on December 14, 2014, 12:09:00 PM
I have a product table with two three keys, productBrand,productCode and ProductSerial. The structure is attached .

I would like to know how can I update and delete the records using the grid.

Table Structure

CREATE TABLE `products` (

`ProductBrand` VARCHAR(20) NOT NULL,

`productcategory` VARCHAR(35) NOT NULL,

`productCode` VARCHAR(15) NOT NULL,

`productSerial` VARCHAR(50) DEFAULT NULL,

`productName` VARCHAR(70) NOT NULL,

`productDescription` TEXT NOT NULL,

`productInstock` SMALLINT NOT NULL,

`productOrder` SMALLINT DEFAULT NULL,

`productTransit` SMALLINT DEFAULT NULL,

`productDispute` SMALLINT DEFAULT NULL,

`productText` VARCHAR(4000) DEFAULT NULL,

`productHtml` TEXT DEFAULT NULL,

`productImage` BLOB DEFAULT NULL,

`productstatus` VARCHAR(1) DEFAULT NULL,

PRIMARY KEY (`productbrand`,`productCode`,`productSerial`),

INDEX (`productName`),

INDEX (`productbrand`),

INDEX (`productcode`),

INDEX (`productserial`)

) ENGINE=InnoDB DEFAULT CHARSET=utf8;



Thanks in advance for your help.


Title: Re: How to update/delete a record from a table with multiple keys
Post by: ehussain on January 16, 2015, 12:51:48 PM
$sql = "update products set productName='$productName'  where ProductBrand = '$ProductBrand' and productCode = '$productCode' and ProductSerial = '$ProductSerial' ";

$result = @mysql_query($sql);