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

 All Forums
 Community Forums
 Code Support: ASP (Non-Forum Related)
 need help with script using array
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

dayve
Forum Moderator

USA
5820 Posts

Posted - 07 August 2001 :  23:59:59  Show Profile  Visit dayve's Homepage
I could use this for statistics based on snitz database information.

http://thepcsweb.com/products/webcharts/exBar.asp

how can I convert this to an loop function for use with like the number of posts a member has on my forum. if I have a clean example I could use it for my other projects. thanks in advance.

Dayve

Edited by - dayve on 08 August 2001 00:01:07

dayve
Forum Moderator

USA
5820 Posts

Posted - 08 August 2001 :  19:40:37  Show Profile  Visit dayve's Homepage
^bump^ any ideas???

Dayve
Go to Top of Page

mrWize
deleted

119 Posts

Posted - 09 August 2001 :  11:22:48  Show Profile
Test this code:

<%
Option Explicit

Response.Buffer = TRUE

Dim strSQLmembers, strSQLcount, strMemberName
Dim objDB, objRSmembers
Dim intTotalMembers, N, intMemberPosts, intArrLength
Dim valList, lblList
N = 0
%>
<HTML>
<HEAD>
<TITLE>BarChart</TITLE>
<META http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</HEAD>

<BODY bgcolor="#FFFFFF" text="#000000">
<%
strSQLcount = "SELECT Count(MEMBER_ID) FROM FORUM_MEMBERS"

strSQLmembers = "SELECT M_USERNAME, M_POSTS FROM FORUM_MEMBERS ORDER BY M_USERNAME ASC"

Set objDB = GetDBConn
Set objRSmembers = objDB.Execute(strSQLcount)
intTotalMembers = objRSmembers(0)

Set objRSmembers = objDB.Execute(strSQLmembers)

If Not objRSmembers.EOF Then

'## -- now we can set the arrays at correct length --
intArrLength = intTotalMembers - 1

'## -- create both arrays in correct length --
ReDim valList(intArrLength)
ReDim lblList(intArrLength)

'## -- loop through the recordset and save member values into both of the arrays --
Do Until objRSmembers.EOF
strMemberName = objRSmembers(0)
intMemberPosts = objRSmembers(1)

'## -- store username and total posts into separate arrays --
valList(N) = intMemberPosts
lblList(N) = strMemberName

objRSmembers.MoveNext
Loop
End If

Set objRSmembers = Nothing
Set objDB = Nothing

'## -- build the barchart --
chartOpt = "Caption:Sales by State;MaxScale:200;GridColor:FF0000;LabelColor:0000FF"

BarChart valList, lblList, chartOpt

%>
</BODY>
</HTML>
<%
'## -- FUNCTION AND SUBS START HERE --
'## -- creates a adodb.connection object and return it --
Function GetDBConn
Dim m_objConn

Set m_objConn = Server.CreateObject("ADODB.Connection")
m_objConn.Open "Provider=SQLOLEDB.1;Server Name=localhost;Database=snitzforum;User ID=sa;Pwd=;"

'## -- return a opened connection object --
Set GetDBConn = m_objConn
End Function
%>


Change the connectionstring to suite your database choice.

cya,
PatrikB

Go to Top of Page

dayve
Forum Moderator

USA
5820 Posts

Posted - 09 August 2001 :  16:00:16  Show Profile  Visit dayve's Homepage
greatly appreciated, I will check it out tonight...

Dayve
Go to Top of Page

mrWize
deleted

119 Posts

Posted - 13 August 2001 :  18:16:02  Show Profile
Hello,

did You get it to work??
cya,
PatrikB a.k.a mrWize

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.21 seconds. Powered By: Snitz Forums 2000 Version 3.4.07