Member Avatar for cuonic

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 ;)

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.

Member Avatar for cuonic

Wow I genuinely totally missed that D:

Thanks for pointing it out ;)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.