|
|
|
จากโค๊ดต้องการลบ multiple delete mysqli แก้ไขโค๊ดยังไงครับ |
|
|
|
|
|
|
|
ไม่ได้ต่างกันครับ เช่น
Code (PHP)
$serverName = "localhost";
$userName = "root";
$userPassword = "root";
$dbName = "mydatabase";
$conn = mysqli_connect($serverName,$userName,$userPassword,$dbName);
$strCustomerID = $_GET["CustomerID"];
$sql = "DELETE FROM customer
WHERE CustomerID = '".$strCustomerID."' ";
$query = mysqli_query($conn,$sql);
|
|
|
|
|
Date :
2017-01-20 16:53:16 |
By :
mr.win |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Code (PHP)
<html>
<head>
<title>ThaiCreate.Com PHP & MySQL Tutorial</title>
</head>
<body>
<?php
$serverName = "localhost";
$userName = "root";
$userPassword = "root";
$dbName = "mydatabase";
$conn = mysqli_connect($serverName,$userName,$userPassword,$dbName);
for($i=0;$i<count($_POST["chkDel"]);$i++)
{
if($_POST["chkDel"][$i] != "")
{
$strSQL = "DELETE FROM customer ";
$strSQL .="WHERE CustomerID = '".$_POST["chkDel"][$i]."' ";
$objQuery =mysqli_query($conn,$strSQL);
}
}
echo "Record Deleted.";
mysql_close($objConnect);
?>
</body>
</html>
|
|
|
|
|
Date :
2017-01-20 16:54:04 |
By :
mr.win |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ขอบคุณมากครับ
|
|
|
|
|
Date :
2017-01-26 12:27:43 |
By :
kooyarut |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 02
|