01.
<html>
02.
<head>
03.
<title>ThaiCreate.Com PHP & MySQL Tutorial</title>
04.
</head>
05.
<body>
06.
<script language=
"JavaScript"
>
07.
function
onDelete()
08.
{
09.
if
(confirm(
'Do you want to delete ?'
)==true)
10.
{
11.
return
true;
12.
}
13.
else
14.
{
15.
return
false;
16.
}
17.
}
18.
</script>
19.
<form name=
"frmMain"
action=
"phpMySQLDeleteMultiRecord.php"
method=
"post"
OnSubmit=
"return onDelete();"
>
20.
<?
21.
$objConnect
= mysql_connect(
"localhost"
,
"root"
,
"root"
)
or
die
(
"Error Connect to Database"
);
22.
$objDB
= mysql_select_db(
"mydatabase"
);
23.
$strSQL
=
"SELECT * FROM customer"
;
24.
$objQuery
= mysql_query(
$strSQL
)
or
die
(
"Error Query ["
.
$strSQL
.
"]"
);
25.
?>
26.
<table width=
"600"
border=
"1"
>
27.
<tr>
28.
<th width=
"91"
> <div align=
"center"
>CustomerID </div></th>
29.
<th width=
"98"
> <div align=
"center"
>Name </div></th>
30.
<th width=
"198"
> <div align=
"center"
>Email </div></th>
31.
<th width=
"97"
> <div align=
"center"
>CountryCode </div></th>
32.
<th width=
"59"
> <div align=
"center"
>Budget </div></th>
33.
<th width=
"71"
> <div align=
"center"
>Used </div></th>
34.
<th width=
"30"
> <div align=
"center"
>
Delete
</div></th>
35.
</tr>
36.
<?
37.
while
(
$objResult
= mysql_fetch_array(
$objQuery
))
38.
{
39.
?>
40.
<tr>
41.
<td><div align=
"center"
><?=
$objResult
[
"CustomerID"
];?></div></td>
42.
<td><?=
$objResult
[
"Name"
];?></td>
43.
<td><?=
$objResult
[
"Email"
];?></td>
44.
<td><div align=
"center"
><?=
$objResult
[
"CountryCode"
];?></div></td>
45.
<td align=
"right"
><?=
$objResult
[
"Budget"
];?></td>
46.
<td align=
"right"
><?=
$objResult
[
"Used"
];?></td>
47.
<td align=
"center"
><input type=
"checkbox"
name=
"chkDel[]"
value=
"<?=$objResult["
CustomerID
"];?>"
></td>
48.
</tr>
49.
<?
50.
}
51.
?>
52.
</table>
53.
<?
54.
mysql_close(
$objConnect
);
55.
?>
56.
<input type=
"submit"
name=
"btnDelete"
value=
"Delete"
>
57.
</form>
58.
</body>
59.
</html>