Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / ColdFusion / Getting Started / August 2006



Tip: Looking for answers? Try searching our database.

hardcoded id in links

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
csber3 - 28 Aug 2006 11:54 GMT
I have a menu where each link looks like this:

<li ><a href="../intranet/index.cfm?id=146">Current Projects</a></span></li>

I want to be able to use the id in the link to identify the title in the
database so i can see the date the linked page was created on. Is there someway
I can say something like:

Check the database for the hardcoded id in the link and pull back the date
colum?

The reason for this is that if the date created is today the style applied to
the link would be different.
Dan Bracuk - 28 Aug 2006 13:13 GMT
Use the cfquery tag.
sid.wing@gmail.com - 29 Aug 2006 09:06 GMT
csber3,

You can retrieve the hardcoded link by calling the URL variable scope.
In this case,
#URL.id# would return the value "146"...

Then you can use a <cfquery> to pull that from your data table...

Example:

<cfquery name="getMyDate" datasource="MyDataSource">
SELECT MyDateColumn
FROM tblMyTable
WHERE fldMyRecordID = #URL.ID#
</cfquery>

> I have a menu where each link looks like this:
>
[quoted text clipped - 9 lines]
>  The reason for this is that if the date created is today the style applied to
> the link would be different.
sid.wing@gmail.com - 29 Aug 2006 10:02 GMT
csber3,

You can retrieve the hardcoded link by calling the URL variable scope.
In this case,
#URL.id# would return the value "146"...

Then you can use a <cfquery> to pull that from your data table...

Example:

<cfquery name="getMyDate" datasource="MyDataSource">
SELECT MyDateColumn
FROM tblMyTable
WHERE fldMyRecordID = #URL.ID#
</cfquery>

> I have a menu where each link looks like this:
>
[quoted text clipped - 9 lines]
>  The reason for this is that if the date created is today the style applied to
> the link would be different.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.