I use php to get information from stored procedures. From this, i get some column with numbers values and in the same column, sometime it's null or has others characters than numbers. I would like to add specific symbol "$" to the one with numbers only(positive or negative). This is what i've done until now :
$sql = "financier_gl @DATE1 = '$from', @DATE2 = '$to', @TARGET = '001'";
$result = sqlsrv_query($conn, $sql);
while ($row = sqlsrv_fetch_array($result))
{
//print_r( $row ); // debug code
if ($row['HTML_CODE'] == 'BOLD(), Green()'){
$couleur='green';
$font= 'bold';
}
else {
$couleur='black';
$font= 'normal';
}
if ($row['Montant'] > 0 ){
echo '$';
}
?>
<tbody>
<tr>
<?php echo "<tr style=\"font-weight:$font; color:$couleur;\">"; ?>
<td style="text-transform:lowercase"><?php echo ($row['Nom']); ?></td>
<td><?php echo ($row['Quantite']); ?></td>
<td><?php echo ($row['Montant']); ?></td>
<td><?php echo ($row['D/C']); ?></td>
<td><?php echo ($row['Debit']); ?></td>
<td><?php echo ($row['Credit']); ?></td>
As you can see, that's "Montant" column only that i would to ask $ and get value only. Any ideas? Thank you
$row['Montant']is a number, you want toecho '$';?