Jump to content

end of mysql


Kingy

Recommended Posts

I have created a news script and its working all good.. whats im doing is

 

<?php

while($news_row = mysql_fetch_array($selectnews)) {

\\LOOP THE NEWS and echo it as it comes out

\\ I then put an <hr> seperator here between each news post

}

?>

 

what i would like to no is, how i can stop the <hr> seperator if it is the last news post. Ill try and draw an image so you get the idea..

 

 

DISPLAY NEWS POST ONE HERE

 

-------------------------------

 

DISPLAY NEWS POST TWO HERE

 

-------------------------------

 

DISPLAY NEWS POST THREE HERE

 

-------------------------------  <- would like to get rid of the last seperator.

Link to comment
https://forums.phpfreaks.com/topic/100448-end-of-mysql/
Share on other sites

My idea: save the total number of news posts with mysql_num_rows($your_query), set up a counter and increase it every time you echo an entry, then check whether it was the last entry and if not, echo a horizontal ruler.

 

But maybe there is a more elegant way.

 

Link to comment
https://forums.phpfreaks.com/topic/100448-end-of-mysql/#findComment-513697
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.