'PHP script which give different result from Mysqli
I am facing a difficulty on my project. I ran the same code in mysql and in my php code, but the result is not the same. It looks like in php my code does not consider the second clause of my php script
I run this code in mysql
SELECT SUM(`montantttc`) AS total_retard_fournisseur FROM facturefournisseur WHERE `datepaiement`<CURDATE() AND `statut`<>"Reglé"
Here is the right result in my database
| total_retard_fournisseur |
|---|
| NULL |
In my php code
include('db.php');
$numretardfour = "SELECT count(*) AS`Retard_Paiement_Fournisseur` FROM facturefournisseur WHERE `datepaiement`<CURDATE() AND (statut<>'Reglé');
$runnumretardfour=mysqli_query($con,"SELECT count(*) AS`Retard_Paiement_Fournisseur` FROM facturefournisseur WHERE `datepaiement`<CURDATE() AND (statut<>'Reglé')");
while($row = mysqli_fetch_array($runnumretardfour)){
?>
<tr>
<td><i class="fa fa-user w3-text-blue w3-large"></i></td>
<td>Nombre de factures fournisseur en retard de paiement</td>
<td><i><?php echo $row["Retard_Paiement_Fournisseur"]; }?> Facture(s)</i></td>
</tr>
The result is
| total_retard_fournisseur |
|---|
| 1250 |
Just to share you everything, you can find my entire table.My DB
Can you help me please to solve this issue?
Thanks
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
