$tableRestProxy->deleteEntity("customer", "myCustomer", $_GET["CusID"]);
<?php require_once "WindowsAzure/WindowsAzure.php"; require_once 'PHPUnit\autoload.php'; use WindowsAzure\Common\ServicesBuilder; use WindowsAzure\Common\ServiceException; // Create Connection String $connectionString = "DefaultEndpointsProtocol=http;AccountName=[yourAccount];AccountKey=[yourKey]"; // Create table REST proxy. $tableRestProxy = ServicesBuilder::getInstance()->createTableService($connectionString); $filter = " PartitionKey eq 'myCustomer' "; try { $result = $tableRestProxy->queryEntities("customer", $filter); } catch(ServiceException $e){ $code = $e->getCode(); $error_message = $e->getMessage(); } $entities = $result->getEntities(); echo " <table width=\"800\" border=\"1\"> <tr> <th width=\"91\"> <div align=\"center\">PartitionKey </div></th> <th width=\"91\"> <div align=\"center\">RowKey </div></th> <th width=\"91\"> <div align=\"center\">CustomerID </div></th> <th width=\"98\"> <div align=\"center\">Name </div></th> <th width=\"198\"> <div align=\"center\">Email </div></th> <th width=\"97\"> <div align=\"center\">CountryCode </div></th> <th width=\"59\"> <div align=\"center\">Budget </div></th> <th width=\"71\"> <div align=\"center\">Used </div></th> <th width=\"71\"> <div align=\"center\">Delete </div></th> </tr> "; foreach($entities as $entity){ echo " <tr> <td><div align=\"center\">". $entity->getPartitionKey()."</div></td> <td><div align=\"center\">".$entity->getRowKey()."</div></td> <td><div align=\"center\">".$entity->getProperty("CustomerID")->getValue()."</div></td> <td>".$entity->getProperty("Name")->getValue()."</td> <td>".$entity->getProperty("Email")->getValue()."</td> <td><div align=\"center\">".$entity->getProperty("CountryCode")->getValue()."</div></td> <td align=\"right\">".$entity->getProperty("Budget")->getValue()."</td> <td align=\"right\">".$entity->getProperty("Used")->getValue()."</td> <td align=\"center\"><a href='phpAzureTable2.php?CusID=".$entity->getProperty("CustomerID")->getValue()."'>Del</a></td> </tr> "; } echo "</table>"; ?>
<?php require_once "WindowsAzure/WindowsAzure.php"; require_once 'PHPUnit\autoload.php'; use WindowsAzure\Common\ServicesBuilder; use WindowsAzure\Common\ServiceException; use WindowsAzure\Table\Models\Entity; use WindowsAzure\Table\Models\EdmType; // Create Connection String $connectionString = "DefaultEndpointsProtocol=http;AccountName=[yourAccount];AccountKey=[yourKey]"; // Create table REST proxy. $tableRestProxy = ServicesBuilder::getInstance()->createTableService($connectionString); try { $tableRestProxy->deleteEntity("customer", "myCustomer", $_GET["CusID"]); header("location:phpAzureTable1.php"); exit(); } catch(ServiceException $e){ $code = $e->getCode(); $error_message = $e->getMessage(); } ?>
ช่วยกันสนับสนุนรักษาเว็บไซต์ความรู้แห่งนี้ไว้ด้วยการสนับสนุน Source Code 2.0 ของทีมงานไทยครีเอท