Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Snitz Forums 2000 MOD-Group
 MOD Add-On Forum (W/Code)
 DB and Variable Help

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!
Before posting, make sure you have read this topic!

Screensize:
UserName:
Password:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkInsert EmailInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
Zuel Posted - 28 October 2005 : 21:58:48
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. <
12   L A T E S T    R E P L I E S    (Newest First)
prescottw Posted - 06 November 2005 : 10:38:00
Thank You Very Much! Just What I was looking for.

-prescottw<
pdrg Posted - 31 October 2005 : 06:01:45
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/vsfctubound.asp

hth<
Zuel Posted - 29 October 2005 : 20:42:34
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.<
ruirib Posted - 29 October 2005 : 19:51:56
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
<
Zuel Posted - 29 October 2005 : 19:36:23
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?<
Zuel Posted - 29 October 2005 : 17:26:16
Ah okay

Thanks a bunch!<
ruirib Posted - 29 October 2005 : 17:19:44
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]
<
Zuel Posted - 29 October 2005 : 17:09:44
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<
ruirib Posted - 29 October 2005 : 17:04:52
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?<
Zuel Posted - 29 October 2005 : 16:28:18
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.<
Zuel Posted - 29 October 2005 : 12:14:14
Oh man just great! Sounds very simple! I might finish this tonight!

Thanks!<
ruirib Posted - 29 October 2005 : 10:45:33
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 Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.08 seconds. Powered By: Snitz Forums 2000 Version 3.4.07