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 Link to comment https://forums.phpfreaks.com/topic/62399-solved-query-question/ 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++ } ?> Link to comment https://forums.phpfreaks.com/topic/62399-solved-query-question/#findComment-310551 Share on other sites More sharing options...
Canman2005 Posted July 30, 2007 Author Share Posted July 30, 2007 Sweeeeeeet Cheers mate Link to comment https://forums.phpfreaks.com/topic/62399-solved-query-question/#findComment-310579 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.