Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Displaying News Items

Status
Not open for further replies.

MONFU

Programmer
Oct 27, 2001
35
MT
This is my scenario. On the left of the screen, I have a list of news items, which are updated by the user and inserted into a database, and then they are dynamically displayed on screen from the database.
Now what I want is that if a user clicks a hyperlink from the left of the screen on a news item, the relevant text is displayed on the right.
What I did up till now was that if I point on a news Item to the left of the screen, I know which item in the recordset it is since I created a counter. What I don't know is how I shall move the recordset to that particular record and display it. I tried rs.move(n) which is the name of the counter but it did not work

can you please help me?

Thanks
 
Hi,

Just pass the ID of the news item back to the page when the link is clicked, by creating an ahref for each link like this:


<ahref=&quot;yourpage.asp?newsitemid=<% =rs(&quot;ID&quot;) %>&quot;><% =rs(&quot;itemtitle&quot;) %></a>

(obviously substituting the fieldnames for yours)

Then when the page is reloaded, check for the item ID in the querystring:

<%

Dim newsitemid

newsitemid = Request.QueryString(&quot;newsitemid&quot;)

%>

Then just query the database for the news text with that particular ID:

<%

strSQL=&quot;SELECT * FROM database WHERE ID =&quot; & newsitemid

etc. etc.

%>

You could also put in check so that a default page is loaded if no item id is specified in the querystring.

Hope this all makes sense.

Good luck Nick (Web Developer)


nick@retrographics.co.uk
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top