while ($row = mysqli_fetch_array($result)) {
echo "<li class='list-inline-item'><a href='news.php?id=" .$row['id']. "'>". $row['titulo'] ."</a></li>";
echo "<br>";
}
I have this little code that searches the bank for all the existing news headlines. As you can see, I also added a link to each of them. But I'd like to know how to handle each of the ids on a next page, to the user clicking on the linked link to open a page with more information.
-
<?php
include("config.php");
if(isset($_GET["id"]))
{
$id = $_GET['id'];
$listagem = "SELECT * FROM noticia WHERE id = $id";
$result = mysqli_query($conexao, $listagem);
$linha = mysqli_fetch_assoc($result);
echo $linha['titulo'];
echo "<br>";
echo $linha['news'];
}
?>