0

Hi,

I am creating a script to show stock information, but the images showing the price difference (down and up arrows) are not appearing in page or in source. They do exist on the server and the src url is correct, so I think it is a PHP problem.

Here is 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 { "<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 { "<img src=\"images/up.png\" />"; } ?>
<?php echo $stockdata['diff']; ?>

<?php } ?>

You can check out the problem here : http://virtualtrader.cuonic.tk/index.php
after creating an account and logging in.

Thanks in advance ;)

Edited by cuonic: n/a

2
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by cuonic
0

I would have thought you need another "echo" after the else, unless this is just a shorthand I am not aware of. I would try commenting out each of the if statements in turn, which will give a better idea of where the problem is.

0

Wow I genuinely totally missed that D:

Thanks for pointing it out ;)

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.