I wonder if it’s possible to do the following script without so much params and strings… I think there is much that can be removed… Maybe with only one query?
Thank you!
<?php
include("sqlvar.php");
$connection = new mysqli($host, $user, $pw, $db);
$marginidb = $connection->query("SELECT valore FROM DATIVENDITA WHERE parametro = 'margine'");
while($margine = $marginidb->fetch_object()) {
$valoremargine = $margine->valore;
}
$connection->close();
echo $valoremargine;
$connection = new mysqli($host, $user, $pw, $db);
$ivadb = $connection->query("SELECT valore FROM DATIVENDITA WHERE parametro = 'iva'");
while($iva = $ivadb->fetch_object()) {
$valoreiva = $iva->valore;
}
$connection->close();
echo $valoreiva;
?>
Here is what I think you’re asking for:
What this does is stores the results as an array so to access the first result you would use
$result[0]and the second would be$result[1]. You could loop thro these results using aforeachloop.