Hi everyone, i'm not an expert so please bear with me
I have a simple form for loging in with a user name and password, after the user is logged in, he sees a very simple access database ,
Is there anyway, i could set it up so depending on the user to view his own data line in the database table, here is the database layout :
SO (for examle ) when john logs in, only sees his info and not anyone else, but yet i want to have a master user to view all..
memberID memeberName Password memeberinfo
1 John John1 $40
2 Bob Bob1 $50
Here is my application varification,
<cflogin>
<cfquery name="qValidLogin" datasource="stock">
SELECT *
FROM tblmember
WHERE tblmember.MemberName = '#Form.username#' AND member.Password = '#Form.password#' </cfquery>
<cfif qValidLogin.RecordCount>
<cfloginuser name="#Form.username#" password="#Form.password#"
<cfset loggedin="1">
<cfelse>
<cfinclude template="index.cfm">
<h3>Your information is not valid.Please try again.</h3>
</cfif>
</cfif>
</cfif>
</cflogin>
And here is my page that is viewd after logging in :
<cfquery name="member_table" datasource="stock">
SELECT *
FROM tblmember
</cfquery>
<cfoutput query="member_table" <td>#member_table.MemberID#</td> <td>#member_table.MemberName#</td>
<td>#member_table.info#</td>
</cfoutput> </table></td>
Any help or reference i'll be greatly appreciated,
i was advised to add a new feild called " upowers" and set it to 0 or 1 (1 for the admin personal and 0 for regular user) and modefy my output query, to
<cfquery name="member_table" datasource="stock">
SELECT *
FROM member
<cfif member.upowers eq 0>
where memberID = #memeberName#
</cfif>
</cfquery>
But it didn't work and , not sure if the where statment should be in the cfif tag, also data type of the new feild is a number, not sure it that is correct or not ?
Thanks alot in advace
Max Tadros
I have a simple form for loging in with a user name and password, after the user is logged in, he sees a very simple access database ,
Is there anyway, i could set it up so depending on the user to view his own data line in the database table, here is the database layout :
SO (for examle ) when john logs in, only sees his info and not anyone else, but yet i want to have a master user to view all..
memberID memeberName Password memeberinfo
1 John John1 $40
2 Bob Bob1 $50
Here is my application varification,
<cflogin>
<cfquery name="qValidLogin" datasource="stock">
SELECT *
FROM tblmember
WHERE tblmember.MemberName = '#Form.username#' AND member.Password = '#Form.password#' </cfquery>
<cfif qValidLogin.RecordCount>
<cfloginuser name="#Form.username#" password="#Form.password#"
<cfset loggedin="1">
<cfelse>
<cfinclude template="index.cfm">
<h3>Your information is not valid.Please try again.</h3>
</cfif>
</cfif>
</cfif>
</cflogin>
And here is my page that is viewd after logging in :
<cfquery name="member_table" datasource="stock">
SELECT *
FROM tblmember
</cfquery>
<cfoutput query="member_table" <td>#member_table.MemberID#</td> <td>#member_table.MemberName#</td>
<td>#member_table.info#</td>
</cfoutput> </table></td>
Any help or reference i'll be greatly appreciated,
i was advised to add a new feild called " upowers" and set it to 0 or 1 (1 for the admin personal and 0 for regular user) and modefy my output query, to
<cfquery name="member_table" datasource="stock">
SELECT *
FROM member
<cfif member.upowers eq 0>
where memberID = #memeberName#
</cfif>
</cfquery>
But it didn't work and , not sure if the where statment should be in the cfif tag, also data type of the new feild is a number, not sure it that is correct or not ?
Thanks alot in advace
Max Tadros