Canman2005 Posted July 30, 2007 Share Posted July 30, 2007 Hi all I have the following query <?php $eventssql = "SELECT * FROM events"; $eventsquery = @mysql_query($eventssql,$connection) or die(mysql_error()); while ($eventsrow = mysql_fetch_array($eventsquery)) { ?> <?php print $eventsrow['title']; ?> <br> +++++++++++++++++ <br> <?php } ?> This basically print something like Event Example One +++++++++++++++ Event Example Two +++++++++++++++ Event Example Three +++++++++++++++ How can I alter the query, so that it doesnt print ++++++++ on the last result, so the above will show as Event Example One +++++++++++++++ Event Example Two +++++++++++++++ Event Example Three Can anyone help? Thanks in advane Ed Quote Link to comment Share on other sites More sharing options...
trq Posted July 30, 2007 Share Posted July 30, 2007 <?php $eventssql = "SELECT * FROM events"; $eventsquery = @mysql_query($eventssql,$connection) or die(mysql_error()); $rows = mysql_num_rows($eventsquery); $i = 1; while ($eventsrow = mysql_fetch_array($eventsquery)) { ?> <?php print $eventsrow['title']; if ($i != $rows) { ?> <br> +++++++++++++++++ <br> <?php } $i++ } ?> Quote Link to comment Share on other sites More sharing options...
Canman2005 Posted July 30, 2007 Author Share Posted July 30, 2007 Sweeeeeeet Cheers mate Quote Link to comment 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.