Jump to content

mysql data and last entry


monkeytooth

Recommended Posts

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

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();

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.