-
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.
Fim do CRUD com MySQL e PHP estruturado
- Loading branch information
1 parent
f4f38d5
commit 721f109
Showing
7 changed files
with
91 additions
and
10 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,18 @@ | ||
<?php | ||
|
||
$id = $_POST["id"]; | ||
$titulo = $_POST["titulo"]; | ||
$sinopse = $_POST["sinopse"]; | ||
|
||
$con = new mysqli("localhost", "root", "", "publicacao"); | ||
|
||
$con->query("update animes set titulo = '$titulo', | ||
sinopse = '$sinopse' where id = $id"); | ||
|
||
$con->close(); | ||
|
||
echo "Alterado com sucesso"; | ||
|
||
?> | ||
|
||
<a href="listagem.php">Listagem</a> |
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
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,49 @@ | ||
<?php | ||
|
||
$id = $_GET["id"]; | ||
|
||
$con = new mysqli("localhost", "root", "", "publicacao"); | ||
|
||
$res = $con->query("select * from animes where id = $id"); | ||
|
||
if ($linha = $res->fetch_object()){ | ||
$id = $linha->id; | ||
$titulo = $linha->titulo; | ||
$sinopse = $linha->sinopse; | ||
$dataCadastro = $linha->data_cadastro; | ||
|
||
|
||
} | ||
|
||
$con->close(); | ||
|
||
?> | ||
|
||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>Editar Anime</title> | ||
|
||
<link rel="stylesheet" href="css/form.css" /> | ||
</head> | ||
|
||
<body> | ||
<h1>Editar de Anime</h1> | ||
|
||
<form action="alterar.php" method="post"> | ||
<input type="hidden" name="id" value="<?=$id?>" /> | ||
|
||
<div class="campo"> | ||
<label>Título</label> | ||
<input type="text" name="titulo" value="<?=$titulo?>" /> | ||
</div> | ||
|
||
<div class="campo"> | ||
<label>Sinopse</label> | ||
<textarea cols="50" rows="5" name="sinopse"><?=$sinopse?></textarea> | ||
</div> | ||
|
||
<input type="submit" value="Salvar" /> | ||
</form> | ||
</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 |
---|---|---|
|
@@ -10,4 +10,6 @@ | |
|
||
echo "Excluído com sucesso"; | ||
|
||
?> | ||
?> | ||
|
||
<a href="listagem.php">Listagem</a> |
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,5 @@ | ||
<?php | ||
|
||
header("Location: listagem.php"); | ||
|
||
?> |
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 |
---|---|---|
|
@@ -10,6 +10,8 @@ | |
|
||
$con->close(); | ||
|
||
echo "Salvo com sucesso"; | ||
echo "Inserido com sucesso"; | ||
|
||
?> | ||
?> | ||
|
||
<a href="listagem.php">Listagem</a> |
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