else if and do while loop...

Hello, I am trying to combine the else if with the do while…

I currently have this code:

	<td class="white dot">
			$status				= '';
			$notesValue			= '';
			$stockValPrice1		= str_replace('$','',$result->swl_stock_price1);		// Get stock price1 
			$stockValPrice2		= str_replace('$','',$result->swl_stock_price2);		// Get stock price2
			$tarValPrice1		= str_replace('$','',$result->swl_target1);			// Get option entry price1 
			$tarValPrice2		= str_replace('$','',$result->swl_target2);			// Get option entry price2
			$stopValPrice		= str_replace('$','',$result->swl_stop);			// Get stop price
			$lastValues			= filter_var($lastValue, FILTER_VALIDATE_FLOAT);
			$stockValsPrice1	= filter_var($stockValPrice1, FILTER_VALIDATE_FLOAT);
			$stockValsPrice2	= filter_var($stockValPrice2, FILTER_VALIDATE_FLOAT);
			$tarValsPrice1		= filter_var($tarValPrice1, FILTER_VALIDATE_FLOAT);
			$tarValsPrice2		= filter_var($tarValPrice2, FILTER_VALIDATE_FLOAT);
			$stopValsPrice		= filter_var($stopValPrice, FILTER_VALIDATE_FLOAT);
			if($lastValues	>= $stockValsPrice1 && $lastValues	<= $stockValsPrice2)	// Check contion for stock entry price
			echo "<img src=".plugins_url( '/images/green-dot.png', __FILE__ ).">";
			$notesValue			= "Stock/Option: ".$result->swl_symbol." Entry price / range of $".$stockValPrice1." to ".$stockValPrice2." has been met.";
            else if($lastValues != ($lastValues  >= $stockValsPrice1 && $lastValues	<= $stockValsPrice2))    	// if above condition is not true, then..
			echo "Watching";
			$notesValue			= "Stock/Option: ".$result->swl_symbol." has been added to the Watchlist.";
			else if($lastValues	>= $tarValsPrice1 && $lastValues	<= $tarValsPrice2)		// Check contion for target price
			echo "<img src=".plugins_url( '/images/yellow-dot.png', __FILE__ ).">";
			$notesValue			= "Stock/Option: ".$result->swl_symbol." Target price / range of $".$tarValPrice1." to ".$tarValPrice2." has been met.You should consider taking profits.";
			else if($lastValues	== $stopValsPrice)		// Check contion for stop price
			echo "<img src=".plugins_url( '/images/red-dot.png', __FILE__ ).">";
			$notesValue			= "Stock/Option: ".$result->swl_symbol." Stop price / range of $".$stopValPrice." has occurred.You should reevaluate or close this trade.";

… and I am trying to combine it with this code:

<?php // Will keep the condition met permanently for green dot ($lastValues >= $stockValsPrice1 && $lastValues <= $stockValsPrice2) = 1; do { echo ""; } while (($lastValues >= $stockValsPrice1 && $lastValues <= $stockValsPrice2) > 0); ?>
                        <?php                                                                           // Will keep the condition met permanently for yellow dot
                         ($lastValues >= $tarValsPrice1 && $lastValues <= $tarValsPrice2) = 1;
                        do {
                             echo "<img src=".plugins_url( '/images/yellow-dot.png', __FILE__ ).">";
                        } while (($lastValues    >= $tarValsPrice1 && $lastValues    <= $tarValsPrice2) > 0);
                        <?php                                                                           // Will keep the condition met permanently for red dot
                         ($lastValues == $stopValsPrice) = 1;
                        do {
                             echo "<img src=".plugins_url( '/images/red-dot.png', __FILE__ ).">";
                        } while (($lastValues == $stopValsPrice) > 0);

I am not a programmer. I build things by asking questions… and I have no idea how to combine these two chunks of code. Any help…?

First, that is diffidently the wrong approach in learning how to code (any programming language), for majority of the time if you do manage to get the script to work it’s a pile of garbage. The code you are combining might be garbage to begin with and this is specially true with PHP code that is found on the internet.

Second, I don’t mind helping people out if they are willing to learn the programming language, just as I expect someone helping me would expect the same thing from me. I not saying playing around with other people’s code isn’t useful, but it’s not useful if the student has no desire to learn the fundamentals of the programming language. While this comment might sound insulting there really isn’t any better way than to tell the truth, well what I perceive is the truth. I’m sure you will get other people to help you out on you programming adventure, but I won’t be one of them. Just make sure you thank the poor sap who took the time and effort to help you out.

Sponsor our Newsletter | Privacy Policy | Terms of Service