mraza Posted October 8, 2009 Share Posted October 8, 2009 hi i am having a parser error with this code : <?php foreach($products as $product); ?> <div class="product"> <h3><?php echo $product['title']; ?></h3> <p><?php echo $product['body']; ?></p> </div> <?php endforeach; ?> but if not include <?php endforeach; ?> it return me one title and body from the database but if i use that statement it is giving me parse error for this line<?php endforeach; ?> ...stuck...cant understand what's going on any help ,, thanks a lot Link to comment https://forums.phpfreaks.com/topic/177013-solved-parse-error-endforeach/ Share on other sites More sharing options...
cags Posted October 8, 2009 Share Posted October 8, 2009 When using the alternate syntax (like you are) the end of the foreach() statement should be terminated by a colon rather than a semicolon. Link to comment https://forums.phpfreaks.com/topic/177013-solved-parse-error-endforeach/#findComment-933319 Share on other sites More sharing options...
mraza Posted October 8, 2009 Author Share Posted October 8, 2009 love you man !! you are the best... what a miss duhhh Link to comment https://forums.phpfreaks.com/topic/177013-solved-parse-error-endforeach/#findComment-933321 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.