|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||
|
|||
|
Any Ideas?
I want a certain row to be seen only by administrators. So I run a query. And "0" = user and "1"=administrator. And it always shows the field regardless of query results,whats wrong? Heres the code.
<!---Run query on variable and set variable to output of query---> <CFQUERY name="info" datasource="LearningCenter"> SELECT Admin FROM user WHERE UserID="#UserID#" </CFQUERY> <cfoutput query="info"> <cfset Admin=info.Admin> </cfoutput> <!--- test to see if Admin---> <CFIF "#Admin#" GT 0> <CFOUTPUT> <TR bgcolor="cccccc"> <td> <strong>Administrator:</strong> </td> <td> <select name="Admin"> <option value="0" selected>No </option> <option value="1">Yes</option> </select> </td> <td></td> </tr> </CFOUTPUT> </cfif> <!---theres got to be a better way. Being a newbie at any language is rough. you make long ineffective code. Any help is greatly appreciated---> |
|
#2
|
|||
|
|||
|
try this
<!---Run query on variable and set variable to output of query--->
<CFQUERY name="info" datasource="LearningCenter"> SELECT Admin FROM user WHERE UserID="#UserID#" </CFQUERY> <cfoutput query="info"> <!--- test to see if Admin---> <CFIF Admin GT 0> <TR bgcolor="cccccc"> <td> <strong>Administrator:</strong> </td> <td> <select name="Admin"> <option value="0" selected>No </option> <option value="1">Yes</option> </select> </td> <td></td> </tr> </cfif> </CFOUTPUT> |
|
#3
|
|||
|
|||
|
Quote:
It is still showing the field. The reason I want to hide it from non admin's is because ofcourse only admins should be able to assign other people as admins. This page is where all people sign up and having that field visible to all would be bad. ![]() |
|
#4
|
|||
|
|||
|
What about this? This should work if the Admin field is 0 or 1.
<!---Run query on variable and set variable to output of query---> <CFQUERY name="info" datasource="LearningCenter"> SELECT Admin FROM user WHERE UserID="#UserID#" </CFQUERY> <CFIF info.recordcount gt 1> More than 1 user returned for that user id!! <cfabort> </cfif> <!--- test to see if Admin---> <CFIF info.Admin eq 1> <TR bgcolor="cccccc"> <td> <strong>Administrator:</strong> </td> <td> <select name="Admin"> <option value="0" selected>No </option> <option value="1">Yes</option> </select> </td> <td></td> </tr> </cfif>
__________________
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 > Any Ideas? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|