?
Solved

passing an id from a query to an a tag

Posted on 2003-03-18
4
Medium Priority
?
153 Views
Last Modified: 2013-12-24
<cfif '#form.email#' is not ''>
<cfquery name="validate" datasource="#dsn#">
SELECT           *
FROM           tablename
WHERE           email = '#form.email#'
AND          password = '#form.password#'
</cfquery>

<!--- i want to take the id from the table and use it in the a tag below for edit. how can i do this? --->

<table width="300" align="center" border="0" cellpadding="1" cellspacing="1">
 <tr>
  <td>a href="editpage.cfm?act=edit&id=#id#">Edit page</a></td>
 </tr>
 <tr>
  <td>a href="send.cfm?id=#url.id#">Apply</a></td>
 </tr>
 </tr>
</table>
0
Comment
Question by:goldiebugs
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 1

Expert Comment

by:Wasistdas
ID: 8163330

<cfif '#form.email#' is not ''>
<cfquery name="validate" datasource="#dsn#">
SELECT           *
FROM           tablename
WHERE           email = '#form.email#'
AND          password = '#form.password#'
</cfquery>

<!--- i want to take the id from the table and use it in the a tag below for edit. how can i do this? --->

<table width="300" align="center" border="0" cellpadding="1" cellspacing="1">
<tr>
 <td><cfoutput><a href="editpage.cfm?act=edit&id=#validate.id#">Edit page</a><cfoutput></td>
</tr>
<tr>
 <td><cfoutput><a href="send.cfm?id=#validate.id#">Apply</a><cfoutput></td>
</tr>
</tr>
</table>
0
 
LVL 6

Accepted Solution

by:
dash420 earned 200 total points
ID: 8164121
<cfif '#form.email#' is not ''>
<cfquery name="validate" datasource="#dsn#">
SELECT           *
FROM           tablename
WHERE           email = '#form.email#'
AND          password = '#form.password#'
</cfquery>

<!--- i want to take the id from the table and use it in the a tag below for edit. how can i do this? --->
<cfoutput query="validate">
<table width="300" align="center" border="0" cellpadding="1" cellspacing="1">
<tr>
 <td>a href="editpage.cfm?act=edit&id=#id#">Edit page</a></td>
</tr>
<tr>
 <td>a href="send.cfm?id=#id#">Apply</a></td>
</tr>
</tr>
</table>
</cfoutput>
0
 

Author Comment

by:goldiebugs
ID: 8168136
oh my - why didn't i think of that?

thank you so much. before posting this question, i tried what Wasistdas said, but that didn't work.

thank you so much!
0
 
LVL 1

Expert Comment

by:Wasistdas
ID: 8168733
I just forgot to slash <cfoutput>. The correct code is:

<cfif '#form.email#' is not ''>
<cfquery name="validate" datasource="#dsn#">
SELECT           *
FROM           tablename
WHERE           email = '#form.email#'
AND          password = '#form.password#'
</cfquery>

<!--- i want to take the id from the table and use it in the a tag below for edit. how can i do this? --->

<table width="300" align="center" border="0" cellpadding="1" cellspacing="1">
<tr>
<td><cfoutput><a href="editpage.cfm?act=edit&id=#validate.id#">Edit page</a></cfoutput></td>
</tr>
<tr>
<td><cfoutput><a href="send.cfm?id=#validate.id#">Apply</a></cfoutput></td>
</tr>
</tr>
</table>

0

Featured Post

Get MySQL database support online, now!

At Percona’s web store you can order your MySQL database support needs in minutes. No hassles, no fuss, just pick and click. Pay online with a credit card.

Question has a verified solution.

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

Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL several years ago, it seemed like now was a good time to update it for object-oriented PHP.  This article does that, replacing as much as possible the pr…
Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
Suggested Courses

752 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