3
I am building the database of a dictionary and I made the code of the page Indice.php that shows the letters of the alphabet:
a) The list appears vertically but I wanted to be horizontal.
b) How to join the list of letters and the list of words on the same page?
We can see here in these pages:
https://www.corampopulo.pt/login/dicionario-penal/indice.php
https://www.corampopulo.pt/login/dicionario-penal/lista.php
...
Follow the code on page 1...
<?php
include 'conn.php';
$sql = "SELECT DISTINCT(SUBSTR(`Palavra`, 1, 1)) As abc from Definicoes_palavras";
$result = $conn->query($sql);
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
Indice das Letras
<br/><br/>
<?php
if ($result->num_rows > 0) {
while($row = $result->fetch_assoc()) {
?>
<a href='lista.php?letter=<?php echo base64_encode($row["abc"]); ?>'><? echo strtoupper($row["abc"]); ?></a><br/>
<?
}
}
?>
</body>
</html>
<?php
$conn->close();
?>
Follow the code on page 2...
<?php
include 'conn.php';
$letter = mysqli_real_escape_string ($conn,htmlspecialchars(base64_decode($_GET["letter"])));
$sql = "SELECT Id,Palavra from Definicoes_palavras where Pronta != 0 AND Palavra LIKE '".$letter."%'";
$result = $conn->query($sql);
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<h2>Letra <?php echo $letter;?> </h2>
<br/><br/>
<a href="https://www.corampopulo.pt/login/dicionario-penal/indice.php">Voltar ao Índice</a>
<br> <br>
<h4>Seleccione um item da lista:</h4>
<?php
if ($result->num_rows > 0) {
while($row = $result->fetch_assoc()) {
?>
<a href='fundamentacao1.php?word=<?php echo base64_encode($row["Id"]); ?>'><? echo $row["Palavra"]; ?></a><br/>
<?
}
}
?>
</body>
</html>
<?php
$conn->close();
?>
OK that’s right Luan Brito... another friend person had already explained to me almost at the same time of his post. But thank you in the same.
– Meireles
opa tranquil then beast
– Luan Brito