Hi... Again :)
Just after i fixed my previous problem thanks to me failing to put an echo before ".."
I worked out that the incorrect image was showing. I'm making a stock trading website, and there will be an red arrow pointing downwards when it detects at - (negative sign). If it doesn't detect it, then it displays the green up arrow.
Problem is, it is showing the green arrow for negative values, and the green arrow for positive values....
Here's the code :
<?php if($_SESSION['loggedin'] === "true") { ?>
<?php include("includes/getstock.php"); ?>
<br/>
<br />
<?php $stockdata = GetStockInfo("GOOG"); ?>
Stock Name : <?php echo $stockdata['name']; ?><br/>
Stock Price : <?php echo $stockdata['price']; ?><br/>
Stock Difference :
<?php if(strpos($stockdata['diff'], "-")) { echo "<img src=\"images/down.png\" />"; } else { echo "<img src=\"images/up.png\" /> "; } ?>
<?php echo $stockdata['diff']; ?><br/><br/>
<?php $stockdata = GetStockInfo("AAPL"); ?>
Stock Name : <?php echo $stockdata['name']; ?><br/>
Stock Price : <?php echo $stockdata['price']; ?><br/>
Stock Difference :
<?php if(strpos($stockdata['diff'], "-")) { echo "<img src=\"images/down.png\" />"; } else { echo "<img src=\"images/up.png\" /> "; } ?>
<?php echo $stockdata['diff']; ?>
<?php } ?>
I'm "trying" to use strpos to find the negative sign, but somehow it isn't working out.
Any help would be greatly appreciated ;)