So I have a code in PHP to display MySQL database information. This is the PHP code:
<?php
$servidor = mysqli_connect ("localhost","root","");
mysqli_select_db($servidor, "produtos");
if (isset($_GET['texto'])) {
$pesquisa = $_GET['texto'];
$query = mysqli_query($servidor, "SELECT * FROM produtos WHERE Nome LIKE '%$pesquisa%' OR Referencia LIKE '%$pesquisa%'");
if(mysqli_num_rows($query) > 0) {
while($resultados = mysqli_fetch_array($query)) {
echo "<h3>Nome: ".$resultados['Nome']."</h3>Referência: ".$resultados['Referencia']."";
}
} else {
echo "<h3>Não foram encontrados resultados!</h3>";
}
}
?>
But right now, that information is displayed in one single line, like this:
and I want to display it in rows, like this:
How can I do this in PHP?
Thank you
You might consider using the new column attributes introduced by CSS 3.
Example:
p { column-count: 3; column-width: 50px; }
<!doctype html> <html lang="de"> <body> <p> First column </p> <p> Second column </p> <p> Third column </p> </body> </html>
This part can be achieved usign HTML + CSS as @Bernhard said. Or, something that I DON'T RECOMMEND, like this:
<div style="width:25%;float:left;padding:10px;">{item}</div>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.