Database connect with php
<?php
error_reporting(0);
include("db.php");
if($_REQUEST['id'] != ""){
$id = $_REQUEST['id'] ;
$del = "delete from one where id = $id";
$dd = mysql_query($del);
}
$q = "select * from one;";
$res = mysql_query($q);
?>
<html>
<head>
<title>3rd page</title>
</head>
<body>
<table border="2" cellpadding="2" cellspacing="2">
<tr>
<td>ID</td>
<td>Name</td>
<td>Email</td>
<td>Password</td>
<td>Delete</td>
<td>Edit</td>
</tr>
<?php
while($row = mysql_fetch_array($res)){
?>
<tr>
<td><?php echo $row['id']; ?></td>
<td><?php echo $row['name']; ?></td>
<td><?php echo $row['email']; ?></td>
<td><?php echo $row['password']; ?></td>
<td><button onClick="return confirm('Are you shure to delete Record No :<?php echo $row['id']; ?>')" href="DatabaseConnect.php?id=<?php echo $row['id']; ?>">Delete</button></td>
<td><a href="Edit.php?id=<?php echo $row['id']; ?>">Edit</a></td>
</tr>
<?php } ?>
</table>
</body>
</html>
error_reporting(0);
include("db.php");
if($_REQUEST['id'] != ""){
$id = $_REQUEST['id'] ;
$del = "delete from one where id = $id";
$dd = mysql_query($del);
}
$q = "select * from one;";
$res = mysql_query($q);
?>
<html>
<head>
<title>3rd page</title>
</head>
<body>
<table border="2" cellpadding="2" cellspacing="2">
<tr>
<td>ID</td>
<td>Name</td>
<td>Email</td>
<td>Password</td>
<td>Delete</td>
<td>Edit</td>
</tr>
<?php
while($row = mysql_fetch_array($res)){
?>
<tr>
<td><?php echo $row['id']; ?></td>
<td><?php echo $row['name']; ?></td>
<td><?php echo $row['email']; ?></td>
<td><?php echo $row['password']; ?></td>
<td><button onClick="return confirm('Are you shure to delete Record No :<?php echo $row['id']; ?>')" href="DatabaseConnect.php?id=<?php echo $row['id']; ?>">Delete</button></td>
<td><a href="Edit.php?id=<?php echo $row['id']; ?>">Edit</a></td>
</tr>
<?php } ?>
</table>
</body>
</html>
Comments
Post a Comment