-
Notifications
You must be signed in to change notification settings - Fork 0
/
46_3_crud_update.php
50 lines (37 loc) · 1.14 KB
/
46_3_crud_update.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Mysql bbdd</title>
</head>
<body>
<?php
$reference = $_GET["reference"];
$description = $_GET["description"];
$updated = $_GET["updated"];
require("38_connection.php");
$connection = mysqli_connect($db_host, $db_user, $db_pass, $db_name);
if (mysqli_connect_errno()){
echo "Connection fail.";
die();
}
mysqli_set_charset($connection, "utf8");
$query = "UPDATE productos
SET descripcion='$description', actualizado='$updated'
WHERE referencia='$reference'";
$result = mysqli_query($connection, $query);
if ($result == false){
echo "Error";
}else{
echo "Record saved";
echo "<form action='46_3_crud_update.php' method='get'>";
echo "<input type='text' name='reference' value='" . $reference . "'><br>";
echo "<input type='text' name='description' value='" . $description . "'><br>";
echo "<input type='datetime-local' name='updated' value='" . $updated . "'><br>";
echo "<input type='submit' name='send' value='updated'>";
echo "</form><br>";
}
mysqli_close($connection);
?>
</body>
</html>