-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
50 lines (39 loc) · 1.39 KB
/
Copy pathindex.php
File metadata and controls
50 lines (39 loc) · 1.39 KB
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 lang="es">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="styles.css">
<title>Personal Notes</title>
</head>
<body>
<h1>Personal Notes</h1>
<br>
<form action="./index.php" method="get" style="display: flex;"><input type="text" name="search" id="search" style="flex: 1;"><button type="submit">Search</button></form>
<br>
<div><a href="./note.php">Add Note</a></div>
<br>
<?php
require_once('connection.php');
// Obtener el término de búsqueda si existe
$search = isset($_GET['search']) ? $_GET['search'] : '';
// Consulta para obtener los títulos de los conocimientos
$sql = "SELECT id, title FROM notes";
if (!empty($search)) {
$sql .= " WHERE title LIKE '%$search%' OR descripcion LIKE '%$search%'";
echo "<p>Search resuts of \"" . $search . "\". <a href=\"./index.php\">Back</a></p><br>";
}
$result = $conn->query($sql);
if ($result->num_rows > 0) {
while ($row = $result->fetch_assoc()) {
echo "<div>" . $row["title"] . " <a href=\"./note.php?id=" . $row["id"] . "\">Open</a></div>";
}
} else {
echo "<p>There are no notes saved.</p>";
}
$conn->close();
?>
<br>
<p style="text-align: center;">© 2025 LionelPonce - Version: 0.1.1</p>
</body>
</html>