Assuming you know it will be three records: $i = 1; while(...) { if($i==3) { //Do the stuff for the last one } else { //Do the rest of the stuff here } $i++; } Assuming you don't know: $count = mysql_num_rows($Result); //or equivalent in AdoDB $i=1; while(...) { if($i==$count) { //Do the stuff for the last one } else { //Do the rest of the stuff here } $i++; } Best regards, Peter Lauri www.dwsasia.com - company web site www.lauri.se - personal web site www.carbonfree.org.uk - become Carbon Free > -----Original Message----- > From: Mário Gamito [mailto:mgamito@xxxxxxxxx] > Sent: Monday, April 09, 2007 3:32 PM > To: php-general@xxxxxxxxxxxxx > Subject: "Sense" last record > > Hi, > > I'm doing this site that has three news in the homepage. > You can see the static version here: > http://www.telbit.pt > As you can see, the two first news have "blocoTexto" class and the > third, "blocoTextoLast" > > Now, i'm developing a dinamyc structure where the news are stored in a > MySQL database and retrieved from there. > > My problem is with the third news and it's different class. > I'm using AdoDB recordSet to get the news from the database. > You can see it here: > http://www.telbit.pt/2/ > > How can i "sense" that i've reached the last row and apply the > "blocoTextoLast" class to it ? > > My code follows my signature. > > Any help would be appreciated. > > Warm Regards > -- > :wq! Mário Gamito > -- > <div id="blocoNews"> > <?php > include('config.php'); > include('adodb/adodb.inc.php'); > > // connect to MySQL > $conn->debug=1; > $conn = &ADONewConnection('mysql'); > > $conn->PConnect($host,$user,$password,$database); > > // get news data > $recordSet = &$conn->Execute("SELECT date, now, title, lead, body > FROM news ORDER BY date DESC LIMIT 3"); > > if (!$recordSet) > print $conn->ErrorMsg(); > else > while (!$recordSet->EOF) { > print '<div class="blocoTexto">' . ' <h3>' . $recordSet->fields[2] . > '</h3>' . '<p class="data">' . $recordSet->fields[0] . '</p>' . > '<p>' . $recordSet->fields[3] . '</p>' . '</div>'; > > $recordSet->MoveNext(); > } > echo "<br class=\"clear\">"; > > $recordSet->Close(); > $conn->Close(); > ?> <!-- end #secContent --> > </div> > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php