loren646 Posted January 29, 2013 Share Posted January 29, 2013 (edited) The table should be at the top but instead the table is below the do statement. Shouldn't the program start from the top and work it's way down? OUTPUT: (basically the TABLE is in the wrong place) http://testingrentals.hostei.com/test.php CODE BELOW: <html> <body> <?php echo "<table border='0' cellpadding='3'>"; echo "<tr>"; echo "<td bgcolor='#CCCCCC' align='center'>Distance</td>"; echo "<td bgcolor='#CCCCCC' align='center'>Cost</td>"; echo "</tr>"; $distance = 50; while ($distance <= 250) { echo "<tr>\n <td align='right'>$distance</td>\n"; echo " <td align = 'right'>".$distance / 10 ."</td>\n</tr>\n"; $distance += 50; } echo "</tables>"; echo '<p>'; $num = 100; do { echo $num.'<br>'; $num += 50; } while ($num<350); ?> </body> </html> Edited January 29, 2013 by loren646 Quote Link to comment https://forums.phpfreaks.com/topic/273804-execution-order-incorrectly-should-be-simple/ Share on other sites More sharing options...
requinix Posted January 29, 2013 Share Posted January 29, 2013 echo ""; Quote Link to comment https://forums.phpfreaks.com/topic/273804-execution-order-incorrectly-should-be-simple/#findComment-1409036 Share on other sites More sharing options...
loren646 Posted January 29, 2013 Author Share Posted January 29, 2013 echo "</tables>"; I deleted that line. Still works but it doesn't change the order. The table still comes after the DO. Also, shouldn't I have it in there to end the table html? Quote Link to comment https://forums.phpfreaks.com/topic/273804-execution-order-incorrectly-should-be-simple/#findComment-1409038 Share on other sites More sharing options...
requinix Posted January 29, 2013 Share Posted January 29, 2013 You should have it. I was pointing out a typo. Quote Link to comment https://forums.phpfreaks.com/topic/273804-execution-order-incorrectly-should-be-simple/#findComment-1409040 Share on other sites More sharing options...
loren646 Posted January 29, 2013 Author Share Posted January 29, 2013 You should have it. I was pointing out a typo. LOL. i kept looking at it. and was like what typo? got it. *slaps head* Quote Link to comment https://forums.phpfreaks.com/topic/273804-execution-order-incorrectly-should-be-simple/#findComment-1409042 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.