Checking if values exist in the database
Hi,
I have problem with the values that are not in the database.
I have a form and there are two types of users:normal and the Admins.
If the user is normal user, he cannot access anyone else entries from the database. But the Admin can access all the entries.
I have done a check to so that the normal user can access only his entries:
<cfif NOT session.Admin AND process.addedBy NEQ #session.AccountID# >
<cflocation url="main.cfm" addtoken="no">
<cfelse>
<!--- rest of the form--->
By these, a normal useer cannot access any entries other than his own.
But for admin, a admin can access all the entries but not the entries that are not in the database. The query related to these form is:
<cfquery name="xx" datasource="yy">
Select entryid, addedBy, deletedBy,processedBy
From yy
where entryid = #URL.entryid# AND processedBy IS NULL AND deletedBy IS NULL
<cfif NOT session.Admin> AND addedBy = #Session.AccountID#
</cfif>
Thus both users can access the respective entries, but when the Admin enters a entryid in the URL not existing in the database, it doesn't take the page back to main page rather it shows the form.
Thus my question is how to avoid the values not in the database.
Thanks for the Help.
Vijayvijay77.
