|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here! |
|
#1
|
|||
|
|||
|
Hi, I have a cfif statement that if the count function from the database is greater than 5 should disable the insert button.
The code below gets ignored. Is there some other way of doing this please? The query works as intended. Thanks for your help. Peter <cfif len(trim(#q_emailcount.email#)) GT 5> <td>Can't insert more!</td> <cfelse> <td><input type="submit" value="Insert record"></td> </cfif> The query is: <cfquery name="q_emailcount" datasource="ipl_sqldb"> SELECT COUNT(emailaddress) AS email FROM dbo.tbproperty WHERE emailaddress = '#Session.MM_username#' </cfquery> |
|
#2
|
|||
|
|||
|
The query is returning a count, which is a number. So let's say that number is 6. The error is in your CFIF. You're doing len() on the number 6, and the length is 1 (it's 1 character).
What you really want is: <cfif q_emailCount.email GT 5>
__________________
Ask if you have a question, but also help answer questions that you have knowledge of! Thanks, Brian. How to Post a Question in the Forums |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ColdFusion Development > greater than |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|