Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Snitz Forums 2000 MOD-Group
 MOD Add-On Forum (W/O Code)
 Accessing a field value
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

zinpin
Junior Member

Australia
202 Posts

Posted - 06 January 2003 :  04:36:55  Show Profile
Hi all,
Just a quick one for a coding guru!

I have added an extra hidden field in the Forum_members table called "CodeField". As the name suggests its there to hold a hidden password that will provide access to specific parts of the site, depending on its value.
Now at a separate part of a forum I want to be able to access the content of that field for the current user because depending on the value in that field they will be given access or not.

What is the code i need: to access and retrieve the value of "CodeField" for the current user ID?

Edited by - ruirib on 06 January 2003 07:15:23

ruirib
Snitz Forums Admin

Portugal
26364 Posts

Posted - 06 January 2003 :  07:41:37  Show Profile  Send ruirib a Yahoo! Message
This code should do it. It admits that you're including config.asp and inc_header.asp in the same page where you'll be doing this.

strSql = "SELECT CodeField FROM " & strMemberTablePrefix" & "MEMBERS WHERE " & strMemberTablePrefix & "MEMBER_ID=" & MemberID

set myRs = my_conn.execute(strSql)

if not myRs.EOF then myCodeField = myRs("CodeField")

myRs.Close
set myRs = nothing

When this code completes, MyCodeField will have the desired CodeField value.


Snitz 3.4 Readme | Like the support? Support Snitz too

Edited by - ruirib on 06 January 2003 08:13:27
Go to Top of Page

zinpin
Junior Member

Australia
202 Posts

Posted - 06 January 2003 :  08:34:01  Show Profile
Thanks Ruirib thats great! Just one more thing if it's ok,
The field in question is a number field in the members table.
What i want to do is include a checkbox in the pop_Profile.asp where
I can either check it on or off.
This checkbox will not be visible by the user as Iam setting the mlev to >3
so only the admin will see it.
I promise this will be the last thing Iam going to ask, What is the code to
inlude this field in the pop_profile.asp page?
Ofcourse it has to be able to update the users record with the fields value.

Hope you can help.

Edited by - zinpin on 06 January 2003 08:56:27
Go to Top of Page

ruirib
Snitz Forums Admin

Portugal
26364 Posts

Posted - 06 January 2003 :  19:01:12  Show Profile  Send ruirib a Yahoo! Message
Zinpin,

We think of Snitz as an ASP learning experience. So, instead of writing the code for you I suggest that you try to do it. There are several checkbox fields in pop_profile.asp and inc_profile.asp. For example, M_RECEIVE_EMAIL. I would suggest that you have a look at the way this field is handled in both files and try to do the same...
It shouldn't be too difficult. I don't have that much time to help people with mods, most my posts helping people don't require me to look at code, I just do it from the top of my head.

You can post for any doubts you have with this, but I suggest that you try to do it yourself.


Snitz 3.4 Readme | Like the support? Support Snitz too
Go to Top of Page

zinpin
Junior Member

Australia
202 Posts

Posted - 06 January 2003 :  19:08:47  Show Profile
thank you for your suggestion ruirib, I posted that late last night and was quite tired and I think a bit lazy to think about it properly... Point taken.
Go to Top of Page

ruirib
Snitz Forums Admin

Portugal
26364 Posts

Posted - 06 January 2003 :  19:16:11  Show Profile  Send ruirib a Yahoo! Message
No problem. I'm sorry for not complying with your request, but I think I must draw the line somewhere, since I already post more than I should. Anyway I promise to assist you as you try it.


Snitz 3.4 Readme | Like the support? Support Snitz too
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.26 seconds. Powered By: Snitz Forums 2000 Version 3.4.07