0
I have a page where it returns a table from my database, but as this table receives several data I am trying to set up a filter for it, I made a form and from it a filter, follows example:
$busca1 = $_POST['input001'];
if ($busca1 != "")
{
$sqli = "SELECT * FROM table WHERE column = '$busca1'";
$resultado = mysqli_query($conn,$sqli) or die("Erro ao retornar dados");
while ($registro = mysqli_fetch_array($resultado))
{
echo "<tr><td>".$registro["Coluna1"] . "</td><td>". $registro["Coluna2"] . "</td><td>". $registro["Coluna3"] . "</td><td>". $registro["Colun4"] . "</td><td>". $registro["Coluna5"] . "</td><td>". $registro["Coluna6"] . "</td><td>". $registro["Coluna7"] . "</td><td>". $registro["Coluna8"] . "</td><td>". $registro["Coluna9"] . "</td><td>". $registro["Coluna10"] . "</td><td>". $registro["Coluna11"]. "</td><td>". $registro["Coluna12"] ."</td></tr>";
}
}
Now I wanted to know how to search joining two fields, it would be something like if ($busca1 != "" && busca2 != "")
and then repeat for all possibilities or there is a better way and with less repetition of code?
And Nathan resolved?
– Willian