Sorry, I only saw the one response to this question so not sure if what I'm 
going to propose was already mentioned and wouldn't work.

Two things come to mind..  first, it looks like "blocoTextoLast" just has 
different margin settings, I assume because it's located on the right side of 
the page content.  Would you care if, for example, you only had two news items 
and the second one (being the last) had margins set to what the first or second 
news items would have and not the "last" item?  That is, does news item #1 or 
#2 need the special formatting that #3 does?

Second, why not just get a count of the number of news items returned by the 
SQL query.  If it's only one, then apply blockoTextoLast to item #1.  If it's 
two, apply it to #2.  If it's three or more, apply it to the third new item?

I guess one more thing could be done.   Create three <div> containers, like 
you're doing now.  Use "blockoTexto" for the first two, and "blockoTextoLast" 
to the third.  It doesn't really matter if they have any content, the class 
stays the same.  Then you don't have to worry if you have 1, 2 or 3 news items.

-TG



= = = Original message = = =
----- Original Message ----- 
From: "M~rio Gamito" <[EMAIL PROTECTED]>
To: <php-general@lists.php.net>
Sent: Monday, April 09, 2007 3:31 PM
Subject: [PHP] "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
>
>
>
> -- 
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.5.446 / Virus Database: 269.0.0/752 - Release Date: 08/04/2007 
> 20:34
>
> 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


___________________________________________________________
Sent by ePrompter, the premier email notification software.
Free download at http://www.ePrompter.com.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to