<html> <head> <title>ThaiCreate.Com PHP & COM (ADO)</title> </head> <body> <?php $strConn = new COM("ADODB.Connection") or die("Cannot start ADO"); $strConn->Open("DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" . realpath("mydatabase.mdb")); $strSQL = "SELECT * FROM customer"; $objRec = $strConn->Execute($strSQL); ?> <table width="600" border="1"> <tr> <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="30"> <div align="center">Delete </div></th> </tr> <?php While (!$objRec->EOF) { ?> <tr> <td><div align="center"><?php echo $objRec->Fields["CustomerID"]->Value;?></div></td> <td><?php echo $objRec->Fields["Name"]->Value;?></td> <td><?php echo $objRec->Fields["Email"]->Value;?></td> <td><div align="center"><?php echo $objRec->Fields["CountryCode"]->Value;?></div></td> <td align="right"><?php echo $objRec->Fields["Budget"]->Value;?></td> <td align="right"><?php echo $objRec->Fields["Used"]->Value;?></td> <td align="center"> <a href="phpComAdoDBDeleteRecord.php?CusID=<?php echo $objRec->Fields["CustomerID"]->Value;?>">Delete</a></td> </tr> <?php $objRec->MoveNext(); } ?> </table> <?php $objRec->Close(); $strConn->Close(); $strConn = null; ?> </body> </html>
<html> <head> <title>ThaiCreate.Com PHP & COM (ADO)</title> </head> <body> <?php $strConn = new COM("ADODB.Connection") or die("Cannot start ADO"); $strConn->Open("DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" . realpath("mydatabase.mdb")); $strSQL = ""; $strSQL .="DELETE FROM customer "; $strSQL .="WHERE CustomerID = '".$_GET["CusID"]."' "; $flgDelete = $strConn->Execute($strSQL); If($flgDelete) { echo("Record Deleted."); } else { echo("Error Delete [".$strSQL."]"); } $strConn->Close(); $strConn = null; ?> </body> </html>
ช่วยกันสนับสนุนรักษาเว็บไซต์ความรู้แห่งนี้ไว้ด้วยการสนับสนุน Source Code 2.0 ของทีมงานไทยครีเอท