HI I am working with the following code which is within a WML page. What I am doing is taking ifo from a database based on username and password criteria and then displaying their personal details to the user in input boxes this saves a returning user form entering these details again. However if the user has more records in the database then coldfusion will display the input boxes and details twice etc. I only want one record to be displayed only once showing one set of input boxes with the users details displayed only one.
I was thinks of a loop until the first record is found then exist the loop but don't know how to do this in cold fusion.
Here is my code:<CFQUERY name="login" datasource="bookings">
SELECT * FROM tblBookings
</CFQUERY>
<CFOUTPUT QUERY="login">
<CFIF #session.username# EQ #Username# AND #session.password# EQ #Password#>
<b>Name:</b><input type="text" value="#Name#" name="name" size="30" maxlength="30"/>
<b>Address:</b><input type="text" value="#Address#" name="address" size="60" maxlength="60"/>
<b>Card No:</b><input type="text" value="#CreditCardNo#" name="cardno" size="19" maxlength="19" format="NNNNNNANNNNNNNNNNNN"/>
<b>Expiry:</b><input type="text" value="#ExpiryDate#" name="expiry" size="5" maxlength="5" format="NNANN"/>
</CFIF>
</CFOUTPUT>
Any ideas appreciated.
I was thinks of a loop until the first record is found then exist the loop but don't know how to do this in cold fusion.
Here is my code:<CFQUERY name="login" datasource="bookings">
SELECT * FROM tblBookings
</CFQUERY>
<CFOUTPUT QUERY="login">
<CFIF #session.username# EQ #Username# AND #session.password# EQ #Password#>
<b>Name:</b><input type="text" value="#Name#" name="name" size="30" maxlength="30"/>
<b>Address:</b><input type="text" value="#Address#" name="address" size="60" maxlength="60"/>
<b>Card No:</b><input type="text" value="#CreditCardNo#" name="cardno" size="19" maxlength="19" format="NNNNNNANNNNNNNNNNNN"/>
<b>Expiry:</b><input type="text" value="#ExpiryDate#" name="expiry" size="5" maxlength="5" format="NNANN"/>
</CFIF>
</CFOUTPUT>
Any ideas appreciated.