» Quick Links
You can make money on these forums
We Share profits with you
Google
Google Adsense
Google Adwords
YPN
Yahoo
MSN Search
Web Directories
Web Hosting
Web Hosting Offers
Hosting News
Suggestions
Link Building
Domain Names
PHP Forums
MySQL Forums
» More Links
OSP News
Reseller Hosting
Shared Hosting
Dedicated Servers
Google Adsense
Search Engine Marketing
Link Development
Affiliate Marketing


» Advertising
Multiple DC PR Check

Free SEO Tools


Go Back   Webmaster Forums > Website Developement / Programming > ASP forums and Tips

ASP forums and Tips Talk about ASP Scripting. .net and Cold Fusion as well.

Reply
 
Thread Tools Display Modes
  #1  
Old 07-30-2006, 12:50 PM
jackman jackman is offline
OSP Starters
 
Join Date: Jul 2006
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
jackman is on a distinguished road
Default wanna highlight latest entry

Hi

I have a database with multiple records which are often updated. I am trying to display the latest entry in a certain way (with css div styles) and then list the rest of the entries another, less elaborate way.
Is there a good / preferred way to do this?
Right now I have it so that it SELECTS TOP 1, displays that in a certain DIV, and then SELECTS * - however what is wrong with this is that it displays the first record twice.

thanks and bye -- This message may have been cut off and the rest will only be shown to members. To become a member, click here --
Reply With Quote
Revenue Sharing Ads ( ?):
  #2  
Old 07-30-2006, 12:52 PM
higgins higgins is offline
OSP Starters
 
Join Date: Jun 2006
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
higgins is on a distinguished road
Default

Try this code out

SELECT TOP 1 *
FROM <table>

UNION

SELECT *
FROM <table>
WHERE <id> <> (SELECT TOP 1 <id> FROM <table>)

hope that it work for u -- This message may have been cut off and the rest will only be shown to members. To become a member, click here --
Reply With Quote
  #3  
Old 07-30-2006, 12:54 PM
acerman acerman is offline
OSP Addicts
 
Join Date: Jun 2006
Posts: 36
Thanks: 0
Thanked 2 Times in 1 Post
Rep Power: 18
acerman is on a distinguished road
Default

You can also try this if you don't have any preference to show details order by any other field

Select userId,userDetails from tableName orderby userId Desc

in this result the first entry is the newest one.
now when you loop through the result set put some condition like if $counter==1 then ... else.... -- This message may have been cut off and the rest will only be shown to members. To become a member, click here --
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
display latest database entry jivasko PHP Programming and Tips 1 08-19-2006 10:37 AM


All times are GMT. The time now is 09:18 PM.