Show a Description from a Database, When a User Clicks on a Link on Webpage?

Hi,

When a news title link on my website is clicked i want it to show the description that goes with that certain title, i have a database in the background which stores all this information however, my success has gotten me only half way (the easy half). I've managed to get the descriptions to show up when a link is clicked however it shows up every description about every news article. Where as i only want a specific one depending on which news title link the user has clicked on.

Please feel free to ask me to explain it in more detail as i understand that description may not be the best tongue.gif

I would attach my database/files to this post however i dont know how to attach files. So i hope you can understand everything from the code below.


Please Help.

Thanks
Armanian

--------------------------------------------------------------------------------- ---------------------------------------------------------------------------------

Index.asp

<html>
<head>

<title>Company Name</title>

<link href="layout.css" rel="stylesheet" type="text/css" />
</head>
<body>

<div id="header">
<div id="logo">
<h1><a href="#"><span>Company Name</span></a></h1>
</div>
<div id="splash"><img src="images/LargeLogo.jpg" alt="" /> </div>
<div id="menu">
<ul id="main">
<li><a href="index.asp">Homepage</a></li>
<li><a href="#">News</a></li>
<li><a href="#">Video</a></li>
<li><a href="#">Galleries</a></li>
<li><a href="#">Blog</a></li>
<li><a href="#">Forum</a></li>
<li><a href="#">Contact Us</a></li>
<li><a href="#">Jobs</a></li>
<li><a href="#">Subscribe</a></li>
</ul>
</div>

</div>
<!-- end header -->

<!-- start page -->
<div id="page">
<div id="sidebar1" class="sidebar">
<ul>
<li>
<h2>Recent Posts</h2>
<ul>
<li><a href="#">Recent Post Link</a></li>
<li><a href="#">Recent Post Link</a></li>
<li><a href="#">Recent Post Link</a></li>
<li><a href="#">Recent Post Link</a></li>
<li><a href="#">Recent Post Link</a></li>
<li><a href="#">Recent Post Link</a></li>
<li><a href="#">Recent Post Link</a></li>
<li><a href="#">Recent Post Link</a></li>
<li><a href="#">Recent Post Link</a></li>
<li><a href="#">Recent Post Link</a></li>
</ul>
</li>

<li>
<h2>Archives</h2>
<ul>
<li><a href="#">Month</a> No. Posts</li>
<li><a href="#">Month</a> No. Posts</li>
<li><a href="#">Month</a> No. Posts</li>
<li><a href="#">Month</a> No. Posts</li>
<li><a href="#">Month</a> No. Posts</li>
</ul>
</li>
</ul>
</div>

<!-- start content -->

<div id="content">
<div class="post">
<h1 class="title">LATEST NEWS</h1>
<p class="byline"><small></small></p>
<div class="entry">
<p><strong><!-- #include file="postNews.asp" --></strong></p>
</div>
</div>
</div>
<!-- end content -->
<!-- start sidebars -->
<div id="sidebar2" class="sidebar">
<ul>
<li>
<h2>Login</h2>
<form action="adminoptions.asp" method="post">
<input type="hidden" name="action" value="validate_login" />
<table border="0">
<tr>
<td align="right">Login:</td>
<td><input type="text" width="50" name="login" style="width:130px;" /></td>
</tr>
<tr>
<td align="right">Password:</td>
<td><input type="password" name="password" style="width:130px;" /></td>
</tr>
<tr>
<td align="right"></td>
<td><input type="submit" VALUE="Login" /></td>
</tr>
</table>
</form>

</li>
<li>
<h2>Categories</h2>
<ul>
<li><a href="#">Catergories</a></li>
<li><a href="#">Catergories</a></li>
<li><a href="#">Catergories</a></li>
<li><a href="#">Catergories</a></li>
<li><a href="#">Catergories</a></li>
<li><a href="#">Catergories</a></li>
<li><a href="#">Catergories</a></li>
<li><a href="#">Catergories</a></li>
<li><a href="#">Catergories</a></li>
<li><a href="#">Catergories</a></li>
<li><a href="#">Catergories</a></li>
<li><a href="#">Catergories</a></li>
</ul>
</li>

<!-- end sidebars -->
<div style="clear: both;"> </div>
</div>
<!-- end page -->
</body>
</html>

postNews.asp

<!-- #include file="callConnection.asp" -->

<style type="text/css">
<!--
.style1 {font-size: xx-small}
-->
</style>

<table border="0">
<%
Do While Not rstSimple.EOF
%>
<tr>
<td><a href='News.asp'><%= rstSimple.Fields("News_Title").Value %></a></td>
<td><span class="style1"><%= rstSimple.Fields("News_Date").Value %></span></td>
</tr>
<tr><td></td></tr>
<tr>
<td></td>
</tr>
<tr><td></td></tr><tr><td></td></tr>
<%
rstSimple.MoveNext
Loop
%>
</table>
<!-- #include file="closeConnection.asp" -->

postDetails.asp
<!-- #include file="callConnection.asp" -->
<table border="0">
<%
Do While Not rstSimple.EOF
%>
<tr>
<td><%= rstSimple.Fields("News_Description").Value %></a></td>
<td></td>
</tr>
<tr><td></td></tr>
<tr>
<td></td>
</tr>
<tr><td></td></tr><tr><td></td></tr>
<%
rstSimple.MoveNext
Loop
%>
</table>
<!-- #include file="closeConnection.asp" -->

callConnection.asp

<%
' Declare our variables... always good practice!
Dim cnnSimple ' ADO connection
Dim rstSimple ' ADO recordset
Dim strDBPath ' path to our Access database (*.mdb) file

strDBPath = Server.MapPath("Database/News.mdb")


Set cnnSimple = Server.CreateObject("ADODB.Connection")


cnnSimple.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strDBPath & ";"

Dim strSQL
strSQL = "SELECT TOP 6 * FROM tblUpdatedNews ORDER BY News_Date DESC"

Set rstSimple = cnnSimple.Execute(strSQL)

%>

closeConnection.asp 
<%
' Close our recordset and connection and dispose of the objects
rstSimple.Close
Set rstSimple = Nothing
cnnSimple.Close
Set cnnSimple = Nothing

%>


News.asp
<html>
<head>

<title>Company Name</title>

<link href="layout.css" rel="stylesheet" type="text/css" />
</head>
<body>

<div id="header">
<div id="logo">
<h1><a href="#"><span>Company Name</span></a></h1>
</div>
<div id="splash"><img src="images/LargeLogo.jpg" alt="" /> </div>
<div id="menu">
<ul id="main">
<li><a href="index.asp">Homepage</a></li>
<li><a href="#">News</a></li>
<li><a href="#">Video</a></li>
<li><a href="#">Galleries</a></li>
<li><a href="#">Blog</a></li>
<li><a href="#">Forum</a></li>
<li><a href="#">Contact Us</a></li>
<li><a href="#">Jobs</a></li>
<li><a href="#">Subscribe</a></li>
</ul>
</div>

</div>
<!-- end header -->

<!-- start page -->
<div id="page">
<div id="sidebar1" class="sidebar">
<ul>
<li>
<h2>Recent Posts</h2>
<ul>
<li><a href="#">Recent Post Link</a></li>
<li><a href="#">Recent Post Link</a></li>
<li><a href="#">Recent Post Link</a></li>
<li><a href="#">Recent Post Link</a></li>
<li><a href="#">Recent Post Link</a></li>
<li><a href="#">Recent Post Link</a></li>
<li><a href="#">Recent Post Link</a></li>
<li><a href="#">Recent Post Link</a></li>
<li><a href="#">Recent Post Link</a></li>
<li><a href="#">Recent Post Link</a></li>
</ul>
</li>

<li>
<h2>Archives</h2>
<ul>
<li><a href="#">Month</a> No. Posts</li>
<li><a href="#">Month</a> No. Posts</li>
<li><a href="#">Month</a> No. Posts</li>
<li><a href="#">Month</a> No. Posts</li>
<li><a href="#">Month</a> No. Posts</li>
</ul>
</li>
</ul>
</div>

<!-- start content -->

<div id="content">
<div class="post">
<h1 class="title">LATEST NEWS</h1>
<p class="byline"><small></small></p>
<div class="entry">
<p><strong><!-- #include file="postDetails.asp" --></strong></p>
</div>
</div>
</div>
<!-- end content -->
<!-- start sidebars -->
<div id="sidebar2" class="sidebar">
<ul>
<li>
<h2>Login</h2>
<form action="adminoptions.asp" method="post">
<input type="hidden" name="action" value="validate_login" />
<table border="0">
<tr>
<td align="right">Login:</td>
<td><input type="text" width="50" name="login" style="width:130px;" /></td>
</tr>
<tr>
<td align="right">Password:</td>
<td><input type="password" name="password" style="width:130px;" /></td>
</tr>
<tr>
<td align="right"></td>
<td><input type="submit" VALUE="Login" /></td>
</tr>
</table>
</form>

</li>
<li>
<h2>Categories</h2>
<ul>
<li><a href="#">Catergories</a></li>
<li><a href="#">Catergories</a></li>
<li><a href="#">Catergories</a></li>
<li><a href="#">Catergories</a></li>
<li><a href="#">Catergories</a></li>
<li><a href="#">Catergories</a></li>
<li><a href="#">Catergories</a></li>
<li><a href="#">Catergories</a></li>
<li><a href="#">Catergories</a></li>
<li><a href="#">Catergories</a></li>
<li><a href="#">Catergories</a></li>
<li><a href="#">Catergories</a></li>
</ul>
</li>

<!-- end sidebars -->
<div style="clear: both;"> </div>
</div>
<!-- end page -->
</body>
</html>

layout.css
body {
text-align:center;
margin-top: 50px;
padding: 0;
background: #000000;
background-repeat: no-repeat;
background-attachment: scroll;
background-position: top center;
font-family: Georgia, "Times New Roman", Times, serif;
font-size: 12px;
color: #616161;
}


h1, h2{
text-align: justify;86
margin-top: 0;
color: #8C0209;
}

h1 {
font-size: 1.6em;
font-weight: normal;
}

h2 {
font-size: 1.6em;
}

a {
text-decoration: none;
color: #6E8A21;

}

a:hover {
border-bottom: none;
}

a img {
border: none;
}

img.left {
float: left;
margin: 0 20px 0 0;
}

img.right {
float: right;
margin: 0 0 0 20px;
}

#header {
text-align:center;
width: 1000px;
margin: 0 auto;
height: 343px;
background: url(images/img02.jpg) repeat-x left top;
}


#logo {
text-align:center;
width: 915px;
height: 82px;
margin: 0 auto;
padding-left: 25px;
background: url(images/LongBanner.jpg) no-repeat left top;
}

#logo h1, #logo p {
float: left;
margin: 0;
}

#logo span {
color: #FFFFFF;
}

#logo h1 {
text-align:center;
padding: 25px 0 0 0;
letter-spacing: -1px;
text-transform: lowercase;
font-weight: normal;
font-size: 3em;
}


#menu {
text-align:center;
width: 940px;
margin: 0 auto;
padding: 0;
height: 50px;
background: url(images/ThinBanner.jpg) no-repeat left top;
}

#menu ul {
margin: 0;
padding: 0;
list-style: none;
}

#menu li {
display: inline;
}

#menu a {
display: block;
float: left;
height: 32px;
margin: 0;
padding: 18px 30px 0 30px;
text-align:center;
text-decoration: none;
text-transform: capitalize;
background: url(images/img03.jpg) no-repeat right top;
font-family: Georgia, "Times New Roman", Times, serif;
font-size: 12px;
color: #FFFFFF;
}



#splash {
width: 940px;
margin: 0 auto;
height: 220px;
}

#page {
width: 940px;
margin: 0 auto;
padding: 5px 0px;
}


#content {
float: left;
width: 490px;
}

.post {
padding-bottom: 15px;
line-height: 200%;
}

.post h1 {
font-weight: normal;
}

.title {
text-align: justify;86
margin: 0;
padding: 10px 0 4px 20px;
font-weight: normal;
}

.title a {
border-bottom: none;
color: #6E8A21;
}

.title a:hover {
border-bottom: 1px dotted #000000;
}

.entry {
padding: 0 0px 0 20px;
}

#sidebar1 {
float: left;
}

#sidebar2 {
float: right;
}

.sidebar {
text-align: justify;86
float: left;
width: 220px;
padding: 0;
font-size: 12px;
background: #282828;
}

.sidebar ul {
margin: 0;
padding: 0;
list-style: none;
}

.sidebar li {
padding: 0 0 20px 0;
}

.sidebar li ul {
}

.sidebar li li {
margin: 0 20px 0 15px;
padding: 8px 0px;
border-bottom: 1px #616161 dashed;
}


.sidebar li h2 {
height: 31px;
margin: 0 0 0 0;
padding: 10px 15px 0px 40px;
background: #4F6517 url(images/SmallBanner.jpg) no-repeat left top;
letter-spacing: -1px;
font-size: 16px;
color: #FFFFFF;
}

.sidebar a {
color: #FFFFFF;
}
Category:campus   
TAG: Infinite Campus Login
Comments: Name:
Copyright©2006-2010 All Rights Reserved