Phần 4 select dử liệu từ cơ sở dữ liệu
function sure()
{
if( confirm("are you sure"))
{
return true;
}
else{
return false;
}
}
</script>
<?php
include("Connection.php");
if(isset($_GET['us'])){//$_GET xữ lý trên trang không chuyển trang
$us = $_GET['us'];
$sq="DELETE FROM customer where username ='$us'";
mysql_query($sq);
}
?>
<title>Document</title>
</head>
<body>
<?php
include('Connection.php');
$result=mysql_query("select * from customer");
?>
<table width="694" border="1">
<tr>
<td width="121">Username</td>
<td width="152">Name</td>
<td width="51">Address</td>
<td width="97">Phone</td>
<td width="100">Avatar</td>
<td width="83">Delete</td>
<td width="83">Update</td>
</tr>
<?php
while($row=mysql_fetch_array($result))
{
?>
<tr>
<td><?php echo $row['username']; ?></td>
<td><?php echo $row['custname']; ?></td>
<td><?php echo $row['address']; ?></td>
<td><?php echo $row['tel']; ?></td>
<td><img src="Image/<?php echo $row['hinhanh']; ?>" width="100" height="100"/></td>
<td><a href="select_cus_del.php?us=<?php echo $row['username']; ?>" onclick="return sure();">delete</a></td>
<td><a href="update_cus.php?us=<?php echo $row['username']; ?>"">update</a></td>
</tr>
<?php
}
?>
</table>
</body>
Tags:
php