Jump to content

[SOLVED] Query question


Canman2005

Recommended Posts

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

<?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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.