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/Code)
 DB and Variable Help
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Zuel
Average Member

USA
540 Posts

Posted - 28 October 2005 :  21:58:48  Show Profile  Visit Zuel's Homepage  Reply with Quote
Sorta Forum Related, didn't see anywhere else to post this.

I'm trying to finish up the Avatars Add-on I am working on. My Database skills are very very weak. I need to do the following and could use some information on the best approach while I attempt to make an Avatar Config file.

New Variables, probably going to post them in the Config.asp file.

Integers
'=== Max File Size for New Avatars ===
intAvatarMaxUploadSize

Possible Booleans
'=== Allow Members to Upload - Yes | No ===
intAvatarAllowUpload
'=== Restrict to Specific Usergroups - Yes | No ===
intAvatarUseUsergroups

I need to create Database space to hold those values.

Now what does the Application() function do? I've read a few things but still unclear to what it is suppose to do. It seems to hold information in memory for all users. Sorta like a universal cookie.

I just don't understand its main use if the config is always present on most files why the Application Variable is used.

If there are any tutorials anywhere on building a config that would be very helpful. I still would need to know how to call the variables from the Database, assign them different values, submit new information and loop through database information.

I'll be trying to practice elsewhere on this.

Any and every help is appreciated. <

My Completed Mods: News Mod | Zuel's Avatar Add-on
In Development: World of Warcraft Member Roster | [C# Based Forum]

Note - I may take a few days to recieve your email. Hotmail filters all new emails as junk. Would be best to post all questions, concerns in a forum topic to catch my immediate attention. This way others can assist and also correct any similar mistakes.

MSN / E-Mail: ucyimDa_Ruler@Hotmail.com

Personal Bookmarks: How to work a DBS File

ruirib
Snitz Forums Admin

Portugal
26364 Posts

Posted - 29 October 2005 :  10:45:33  Show Profile  Send ruirib a Yahoo! Message  Reply with Quote
Basically you should define those variables in the database, into the FORUM_CONFIG_NEW. A dbs file for that could be something like this:

Zuel's Avatar Add-On


[INSERT]
CONFIG_NEW
(C_VARIABLE,C_VALUE)#('intAvatarMaxUploadSize','100000')
(C_VARIABLE,C_VALUE)#('intAvatarAllowUpload','1')
(C_VARIABLE,C_VALUE)#('intAvatarUseUsergroups','0')
[END]

For boolean variables '0' meaning No and '1' meaning Yes. The value for upload size is just an example.

Then you need to declare the variables in config.asp, just below the existing definition:



Dim SubCount, MySubCount


Dim intAvatarMaxUploadSize, intAvatarAllowUpload, intAvatarUseUsergroups


Then get the values from the App Variables (add them below the existing ones):


intAvatarMaxUploadSize = Application(strCookieURL & "INTAVATARMAXUPLOADSIZE")
intAvatarAllowUpload = Application(strCookieURL & "INTAVATARALLOWUPLOAD")
intAvatarUseUsergroups = Application(strCookieURL & "INTAVATARUSEUSERGROUPS")


Once you run the dbs file and add these changes to config.asp, running setup.asp will load the variables values from FORUM_CONFIG_NEW into the app variables, which means that your variables will hold the values as specified in the dbs file.
You can then test and change the variables in your pages. Probably adding a mod administration page where you can change their values would be a good option too.<


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

Zuel
Average Member

USA
540 Posts

Posted - 29 October 2005 :  12:14:14  Show Profile  Visit Zuel's Homepage  Reply with Quote
Oh man just great! Sounds very simple! I might finish this tonight!

Thanks!<

My Completed Mods: News Mod | Zuel's Avatar Add-on
In Development: World of Warcraft Member Roster | [C# Based Forum]

Note - I may take a few days to recieve your email. Hotmail filters all new emails as junk. Would be best to post all questions, concerns in a forum topic to catch my immediate attention. This way others can assist and also correct any similar mistakes.

MSN / E-Mail: ucyimDa_Ruler@Hotmail.com

Personal Bookmarks: How to work a DBS File
Go to Top of Page

Zuel
Average Member

USA
540 Posts

Posted - 29 October 2005 :  16:28:18  Show Profile  Visit Zuel's Homepage  Reply with Quote
Hehehe I knocked out 2 big portions out already
I'm near 85%. Yippppeee!

With those new variables and an array I was able to create the Category Navigation dynamically!

Yeah!

Now with the Avatar_Config file, to update the database all I do is something like:

[CREATE]
AVATAR_CATEGORIES
(CATEGORY_ID,CATEGORY_NAME)#('1','EDITME')
[END]

Then to add a new record something like:

strSql = "INSERT INTO " & strTablePrefix & "AVATAR_CATEGORIES (CATEGORY_NAME) VALUES(" & strNewCategory & ")"

I haven't tried the SQL yet, rather get an okay from you guys first so I don't screw stuff up.

Once that is done, how do I pull the information? I don't have a application variable with this one. I need to loop the information out into an array more then likely. Then do a split I think.<

My Completed Mods: News Mod | Zuel's Avatar Add-on
In Development: World of Warcraft Member Roster | [C# Based Forum]

Note - I may take a few days to recieve your email. Hotmail filters all new emails as junk. Would be best to post all questions, concerns in a forum topic to catch my immediate attention. This way others can assist and also correct any similar mistakes.

MSN / E-Mail: ucyimDa_Ruler@Hotmail.com

Personal Bookmarks: How to work a DBS File
Go to Top of Page

ruirib
Snitz Forums Admin

Portugal
26364 Posts

Posted - 29 October 2005 :  17:04:52  Show Profile  Send ruirib a Yahoo! Message  Reply with Quote
To add the record to the table, the dbs file should be:

[INSERT]
AVATAR_CATEGORIES
(CATEGORY_NAME)#('EDITME')
[END]

I'm admiting the table has an automatically assiged category id.

What do you want to pull?<


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

Zuel
Average Member

USA
540 Posts

Posted - 29 October 2005 :  17:09:44  Show Profile  Visit Zuel's Homepage  Reply with Quote
The information I added. Also I have to create that table in the DB first.

Like the Value 'EDITME' and the rest of the values that will come.

Could be 'General', 'Misc', 'Funny', etc<

My Completed Mods: News Mod | Zuel's Avatar Add-on
In Development: World of Warcraft Member Roster | [C# Based Forum]

Note - I may take a few days to recieve your email. Hotmail filters all new emails as junk. Would be best to post all questions, concerns in a forum topic to catch my immediate attention. This way others can assist and also correct any similar mistakes.

MSN / E-Mail: ucyimDa_Ruler@Hotmail.com

Personal Bookmarks: How to work a DBS File

Edited by - Zuel on 29 October 2005 17:10:55
Go to Top of Page

ruirib
Snitz Forums Admin

Portugal
26364 Posts

Posted - 29 October 2005 :  17:19:44  Show Profile  Send ruirib a Yahoo! Message  Reply with Quote
To retrieve the value you will need to use a SELECT statement, move it into an array with getRows and loop.

The dbs to create the table could be:

[CREATE]
AVATAR_CATEGORY
CATEGORY_ID
CATEGORY_NAME#varchar(100)##
[END]
<


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

Zuel
Average Member

USA
540 Posts

Posted - 29 October 2005 :  17:26:16  Show Profile  Visit Zuel's Homepage  Reply with Quote
Ah okay

Thanks a bunch!<

My Completed Mods: News Mod | Zuel's Avatar Add-on
In Development: World of Warcraft Member Roster | [C# Based Forum]

Note - I may take a few days to recieve your email. Hotmail filters all new emails as junk. Would be best to post all questions, concerns in a forum topic to catch my immediate attention. This way others can assist and also correct any similar mistakes.

MSN / E-Mail: ucyimDa_Ruler@Hotmail.com

Personal Bookmarks: How to work a DBS File
Go to Top of Page

Zuel
Average Member

USA
540 Posts

Posted - 29 October 2005 :  19:36:23  Show Profile  Visit Zuel's Homepage  Reply with Quote
I can't get it to work.

Here's what I have:

'=== Set Database Connection ===
set rs = Server.CreateObject("ADODB.Recordset")

strSql = "SELECT Category_Name FROM " & strTablePrefix & "Avatar_Category"

'=== Open Database Connection ===
rs.open strSql, my_Conn

Dim arrayAvatarRows
arrayAvatarRows = RS.GetRows()

Dim arrayAvatarData

For Each arrayElement in arrayAvatarRows
arrayAvatarData = arrayAvatarRows
Next

Response.Write (arrayAvatarData)

Just testing what its pulling and I'm getting an error.

Response object, ASP 0106 (0x80020005)
An unhandled data type was encountered.
/twistingshadows/forum/avatars.asp

Looks like a Response.Write error. That means I'm trying to write data in an invalid way. How should I write it?<

My Completed Mods: News Mod | Zuel's Avatar Add-on
In Development: World of Warcraft Member Roster | [C# Based Forum]

Note - I may take a few days to recieve your email. Hotmail filters all new emails as junk. Would be best to post all questions, concerns in a forum topic to catch my immediate attention. This way others can assist and also correct any similar mistakes.

MSN / E-Mail: ucyimDa_Ruler@Hotmail.com

Personal Bookmarks: How to work a DBS File
Go to Top of Page

ruirib
Snitz Forums Admin

Portugal
26364 Posts

Posted - 29 October 2005 :  19:51:56  Show Profile  Send ruirib a Yahoo! Message  Reply with Quote
There are several examples in the Snitz code on how to handle that. The loop for the cat names could be...


iCatCount = UBound(arrayAvatarRows,2)

for iCat = 0 to iCatCount

    strCatName = arrayAvatarRows(0, iCat)
    Response.Write strCatName & "<br />"
next
<


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

Zuel
Average Member

USA
540 Posts

Posted - 29 October 2005 :  20:42:34  Show Profile  Visit Zuel's Homepage  Reply with Quote
Gah it worked!

Now what the hell does UBound(arrayAvatarRows,2) do?

I know UBound gets the highest count of records within an array but what is the ", 2)" for?

Thanks ruirib, you've been a great help! Now to combine it all.<

My Completed Mods: News Mod | Zuel's Avatar Add-on
In Development: World of Warcraft Member Roster | [C# Based Forum]

Note - I may take a few days to recieve your email. Hotmail filters all new emails as junk. Would be best to post all questions, concerns in a forum topic to catch my immediate attention. This way others can assist and also correct any similar mistakes.

MSN / E-Mail: ucyimDa_Ruler@Hotmail.com

Personal Bookmarks: How to work a DBS File
Go to Top of Page

pdrg
Support Moderator

United Kingdom
2897 Posts

Posted - 31 October 2005 :  06:01:45  Show Profile  Send pdrg a Yahoo! Message  Reply with Quote
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/vsfctubound.asp

hth<
Go to Top of Page

prescottw
Junior Member

189 Posts

Posted - 06 November 2005 :  10:38:00  Show Profile  Send prescottw a Yahoo! Message  Reply with Quote
Thank You Very Much! Just What I was looking for.

-prescottw<

What day is it anyway?
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.16 seconds. Powered By: Snitz Forums 2000 Version 3.4.07