-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CRUD APLLICATION USING PHP AND MYSQL
- Loading branch information
0 parents
commit 63a55bd
Showing
4 changed files
with
165 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php | ||
include 'connect.php'; | ||
if(isset($_GET['deleteid'])) | ||
{ | ||
$id=$_GET['deleteid']; | ||
$sql= "DELETE FROM `added` WHERE `added`.`id`=$id"; | ||
$result=mysqli_query($con,$sql); | ||
if ($result) | ||
{ | ||
header('location:display.php'); | ||
}else{ | ||
die(mysqli_error($con)); | ||
} | ||
} | ||
|
||
|
||
|
||
|
||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
<?php | ||
include 'connect.php'; | ||
?> | ||
<!DOCTYPE html> | ||
<head> | ||
<link rel="stylesheet" href="main.css"> | ||
</head> | ||
<body> | ||
<div class="container"> | ||
<br> | ||
<button class="btn btn-primary"><a href="main.php">add user</a> | ||
</button> | ||
<table> | ||
<thead> | ||
<tr> | ||
<th scope="col">sl</th> | ||
<th scope="col">name</th> | ||
<th scope="col">email</th> | ||
<th scope="col">mobile</th> | ||
<th scope="col">password</th> | ||
<th scope="col">operation</th> | ||
</tr> | ||
|
||
</thead> | ||
<tbody> | ||
|
||
<?php | ||
$sql="SELECT * FROM `added` ORDER BY `id` ASC"; | ||
$result=mysqli_query($con,$sql); | ||
if($result){ | ||
while($row=mysqli_fetch_assoc($result)){ | ||
$id=$row['id']; | ||
$name=$row['name']; | ||
$email=$row['email']; | ||
$mobile=$row['mobile']; | ||
$password=$row['password']; | ||
echo '<tr> | ||
<td>'.$id.'</td> | ||
<td>'.$name.'</td> | ||
<td>'.$email.'</td> | ||
<td>'.$mobile.'</td> | ||
<td>'.$password.'</td> | ||
<td> | ||
<button><a href="delete.php? deleteid='.$id.'">delete</a></button> | ||
<button><a href="update.php?updateid='.$id.'">update</a></button> | ||
</td> | ||
</tr>'; | ||
} | ||
} | ||
|
||
|
||
|
||
?> | ||
</tbody> | ||
</table> | ||
</div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
body{ | ||
background-color: powderblue; | ||
margin-left: 4px; | ||
} | ||
button{ | ||
background-color: rgb(0, 255, 64); | ||
} | ||
.container{ | ||
text-align: center; | ||
justify-content: center; | ||
align-items: center; | ||
width: 1050px; | ||
font-size:x-large; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
<?php | ||
|
||
include 'connect.php'; | ||
$id=$_GET['updateid']; | ||
if(isset($_POST['submit'])){ | ||
|
||
$name=$_POST['name']; | ||
$email=$_POST['email']; | ||
$phone=$_POST['mobile']; | ||
$password=$_POST['password']; | ||
|
||
|
||
|
||
$sql="UPDATE `added` SET `name` = '$name', `email` = '$email', `mobile` = '$phone', `password` = '$password' | ||
WHERE `added`.`id` =$id"; | ||
|
||
$result=mysqli_query($con,$sql); | ||
if ($result) | ||
{ | ||
header('location:display.php'); | ||
}else{ | ||
die(mysqli_error($con)); | ||
} | ||
} | ||
?> | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>addt</title> | ||
<link rel="stylesheet" href="main.css"> | ||
</head> | ||
<body> | ||
<div class="container my-5"> | ||
<<form method = "post" action = "<?php $_PHP_SELF ?>"> | ||
<div class=""form-group> | ||
<label >name</label> | ||
<br> | ||
<input type="text" name="name" class="form-control" placeholder="Enter you name"> | ||
<br> | ||
|
||
</div> | ||
<div class="form-group"> | ||
<label >Email</label> | ||
<br> | ||
<input type="email" name="email" class="form-control" placeholder="Enter your email"> | ||
<br> | ||
|
||
</div> | ||
<div class="form-group"> | ||
<label >phone number</label> | ||
<br> | ||
<input type="text" name="mobile" class="form-control" placeholder="Enter you phone number"> | ||
<br> | ||
|
||
</div> | ||
<div class="form-group"> | ||
<label >password</label> | ||
<br> | ||
<input type="password" name="password" class="form-control" placeholder="Enter your password"> | ||
<br> | ||
|
||
</div> | ||
<br> | ||
<button type="submit" name="submit">update</button> | ||
</form> | ||
</div> | ||
</body> | ||
</html> |