44 lines
1.5 KiB
PHP
44 lines
1.5 KiB
PHP
|
<?php
|
||
|
require "includes/config/database.php";
|
||
|
$db =conectarDB();
|
||
|
if ($db->connect_errno) {
|
||
|
// Print the connection error message
|
||
|
echo "Failed to connect to MySQL: " . mysqli_connect_error();
|
||
|
// You can also log the error message to a file or other logging mechanism
|
||
|
// error_log("Failed to connect to MySQL: " . mysqli_connect_error());
|
||
|
exit(); // Exit the script if there's a connection error
|
||
|
}
|
||
|
|
||
|
$getNotes = "select * from notag" ;
|
||
|
$notes = mysqli_query($db,$getNotes);
|
||
|
mysqli_close($db);
|
||
|
?>
|
||
|
<!DOCTYPE html>
|
||
|
<html lang="en">
|
||
|
<head>
|
||
|
<meta charset="UTF-8">
|
||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||
|
<link rel="stylesheet" href="src/prueba.css">
|
||
|
<title>Document</title>
|
||
|
</head>
|
||
|
<body>
|
||
|
<div class="contenedor">
|
||
|
|
||
|
<h1>Notes manager</h1>
|
||
|
<form class="addNote"id="myForm" method="post" action="includes/create.php">
|
||
|
<label for="note"></label>
|
||
|
<input name="note" id="note" type="text">
|
||
|
<input class="button greenButton" type="submit" value="add">
|
||
|
</form>
|
||
|
<?php while($row=mysqli_fetch_array($notes)){?>
|
||
|
<div class="note">
|
||
|
<p><?php echo $row['noteContent'] ?></p>
|
||
|
<form action="includes/delete.php" method="post">
|
||
|
<input type="hidden" name="id" value="<?php echo $row['id']?>"> <!-- Aquí puedes poner el ID del elemento a eliminar -->
|
||
|
<input class="button redButton" type="submit" name="delete" value="delete">
|
||
|
</form>
|
||
|
</div>
|
||
|
<?php }?>
|
||
|
</div>
|
||
|
</body>
|
||
|
</html>
|