jacko_162 Posted March 18, 2010 Share Posted March 18, 2010 i have 14 pieces of data to echo on a page, each one of these 14 has 3 seperate peieces of information to print; label data if statement (if data is between a certain range show image else show other image) and my coding is like this; <td width="26%"> <div align="right"><em><strong>label: </strong></em></div></td> <td width="8%"><?php echo $test1 ?>ppt</td> <td width="15%"><?php $val1 = 1.022; //----- Lowest Value $val2 = 1.027; //----- Highest Value $val3 = $test1; //----- Test Value (change number accordingly) if (($val3 > $val1) && ($val3 < $val2)) {echo '<img src="img/bullet_green.png" alt="" width="8" height="8" />';} else {echo '<img src="img/bullet_red.png" alt="" width="8" height="8" />';} ?></td> now what i wanted to do was include all this in an if command: <?php echo (in_array("test1",$arr) ? "<td>INSERT DATA HERE</td>" : ''); ?> whenever i try to output all the above information in the above coding i get all sorts of display errors (no sql errors) the above code checks an array and check the status of "test1" if test1 is in the array then show data. can anyone help me write out a tidier coding to make it all work, i want it to check is "test1" is in the array then show a whole <tr> row containing more data and echo commands. many thanks. Link to comment https://forums.phpfreaks.com/topic/195669-trying-to-limit-data-show-using-if-and-echo-commands/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.