I have a table in which $row['command'] is a '0'. But when I call it, it is not zero. In fact it shows the value of the command of other.
I know I might not be clear but my code should explain the whole incidence:
PHP Code:
<?php
//Request to take the prospect and the total nb id
$query_vg ="
SELECT substr(customers_from, 1, 3) AS Origin,
COUNT( customers_id) AS effectif_vg
FROM customers
GROUP BY Origin ";
$result_vg = mysql_query($query_vg) ;
//Request to make the prospect, nb command and the average amount command.
$query = " SELECT substr(customers_from, 1, 3) AS Origin,
count(co.command_status) AS command,
AVG(co.command_amount) AS amt
FROM customers cu
INNER JOIN command co
ON cu.customers_id=co.customers_id
WHERE co.command_status='1'
GROUP BY Origin ";
$result = mysql_query($query) ;
while ($row1 = mysql_fetch_array($result_vg) and $row = mysql_fetch_array($result) )
{
?>
<tr>
<td style="background-color:#CCCCCC;"> </td>
<td style="text-align:center;"> <?php echo $row1['Origin'] ?> </td>
<td style="text-align:center;"> <?php echo $row1['effectif_vg'] ?> </td>
<td style="text-align:center;"> <?php echo $row['command'] ?> </td>
<td style="text-align:center;"> <?php echo round(($row['command']*$row['amt'])) ?> euro</td>
<td style="text-align:center;"> <?php echo round($row['amt'] ,2)?> </td>
</tr>
<?php
}
?>
Bookmarks