Solved

If Row has a value, then display URL

Posted on 2003-11-30
4
138 Views
Last Modified: 2013-12-24
I want to do this.

Show rows from my table dynamically. I know how to do this.

If the current record being shown does not have an empty value in the Description column, then show the words DESC.

DESC will be a link that opens a new window showing only that particular records Description field.

<TABLE WIDTH="99%" BORDER="0" CELLSPACING="0" CELLPADDING="0">
  <TR>
    <TD>ID</TD>
    <TD>Type</TD>
    <TD>Description</TD>
  </TR>
  <cfoutput QUERY="cars">
  <TR>
 
    <TD>#ID#</TD>
    <TD>#VehicleType#</TD>
    <TD>#Description#</TD>
  </TR></cfoutput>
</TABLE>
0
Comment
Question by:zakirdavis
  • 2
  • 2
4 Comments
 
LVL 12

Expert Comment

by:jyokum
ID: 9848208
<cfoutput QUERY="cars">
  <TR>
    <TD>#ID#</TD>
    <TD>#VehicleType#</TD>
    <TD>
    <cfif len(cars.description)>
      <a href="whatever.cfm?ID=#cars.ID#">DESC</a>
    </cfif>
    </TD>
  </TR>
</cfoutput>
0
 

Author Comment

by:zakirdavis
ID: 9848251
For the page whatever.cfm,

In order to be able to reuse this page for my other tables, i think i will want to pass what table it is coming from. I have a hidden input field for this traveling from the original page that states what table it is coming from.

ex. on my cars.cfm page, i created a hidden field (TYPEFLAG) with value=cars.
on trucks.cfm page, i created a hidden field (TYPEFLAG) with  value=trucks

I know i will have to have a CFQUERY to talk to the DB (on the whatever.cfm page), but how will i take the value from the URL and use it in my CFQUERY?

??
<CFQUERY name="allVehicles" datasource="Vehicles">
SELECT Desc FROM #TYPEFLAG# Where ID IS url.whatever
</CFQUERY>
??

Also, how would i append more than one value to the url?

??
<a href="whatever.cfm?ID=#cars.ID#"&Table=#TYPEFLAG#>DESC</a>
??
0
 
LVL 12

Accepted Solution

by:
jyokum earned 500 total points
ID: 9848253
<a href="whatever.cfm?ID=#cars.ID#&Table=#TYPEFLAG#">DESC</a>

then on whatever.cfm

<CFQUERY name="allVehicles" datasource="Vehicles">
SELECT Desc FROM #url.table# Where ID = <cfqueryparam value="#url.ID#" cfsqltype="cf_sql_numeric">
</CFQUERY>
0
 

Author Comment

by:zakirdavis
ID: 9848407
Thank you so very much. You are a big help!
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This is a guide to setting up a new WHM/cPanel Server to be used for web hosting accounts. It is intended for web hosting company administrators and dedicated server owners. For under $99 per month (considering normal rate of Big Data Cetnters like …
A web service (http://en.wikipedia.org/wiki/Web_service) is a software related technology that facilitates machine-to-machine interaction over a network. This article helps beginners in creating and consuming a web service using the ColdFusion Ma…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.

785 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question