monkeytooth Posted June 1, 2009 Share Posted June 1, 2009 So im working up a quick simple while loop to pull everything out of one table, which works fine.. However in the while loop I am having it append a period and a <br /> to the end of every row. Now what I want to do is the last entry is append something else. How can I find within the loop the last item being pulled, or is a while loop just the wrong route to go? Link to comment https://forums.phpfreaks.com/topic/160438-mysql-data-and-last-entry/ Share on other sites More sharing options...
ram4nd Posted June 1, 2009 Share Posted June 1, 2009 Take the first row and order id by descending. Link to comment https://forums.phpfreaks.com/topic/160438-mysql-data-and-last-entry/#findComment-846653 Share on other sites More sharing options...
monkeytooth Posted June 1, 2009 Author Share Posted June 1, 2009 This is what im working with... im trying to catch the last result in the loop and make it have something diffrent from the regular results in the loop.. however Im not sure I can go about catching what would be the last result and doing that with, what I have done ultimately does the same thing to all from begining to end.. I just want the end entry to not have the appended data.. $dbconn = mysql_connect($sq_hst, $sq_unme, $sq_pzwrd) or die ("Error in Settings: " . $query_settings . "<br />" . mysql_error()); $display_query = " SELECT * FROM mtplistme ORDER BY email ASC"; $display_result = mysql_query($display_query) or die('Display Error, query failed<br>' . mysql_error()); while($row_jobs = mysql_fetch_array($display_result)) { $emailz = $row_jobs['email'] . ". <br /> "; echo $emailz; } mysql_close(); Link to comment https://forums.phpfreaks.com/topic/160438-mysql-data-and-last-entry/#findComment-846656 Share on other sites More sharing options...
PFMaBiSmAd Posted June 1, 2009 Share Posted June 1, 2009 Just form the output in a variable and trim or otherwise remove the extra characters from the end of the variable. Link to comment https://forums.phpfreaks.com/topic/160438-mysql-data-and-last-entry/#findComment-846664 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.