Logic for Modification to File Library?

Snitz™ Forums 2000
https://forum.snitz.com/forumTopic/Posts/65579?pagenum=1
05 November 2025, 12:21

Topic


JJenson
Logic for Modification to File Library?
12 September 2007, 23:05


Ok I hope I can explain what I am trying to do here and I am hoping someone can help me with the logic on how to go about accomplishing this.
First here is the link to the file library which I am making the modifications to: http://www.vmcplugins.com/forum/file_library.asp

Ok now I will try to explain as best I can:

I need to be able to specify when uploading a file if it goes into Free Downloads or Paid Downloads

I want to be able to sort the categories however I see fit from the admin section kind of how the forums and categories are aligned.

I am not sure all the logic that would be needed to do something like this I mainly got my layout how I need it and now am trying to figure out how to attack what I am trying to do. Mainly seperate Free and Paid and be able to order them how I need to.

Thanks bigsmile
<

 

Replies ...


JJenson
16 September 2007, 00:10


OK I think I am getting through this but I am a little stuck in one spot here.
I have this code to display what is in the database as Forum Version this is the code:

Code:

if MyVersion = "0" or MyVersion = "" then
Response.Write "N/A"
else
strSql = "SELECT F_VERSION "
strSql = strSql & "FROM " & strTablePrefix & "FILEVERSION "
strSql = strSql & "WHERE ID IN (" & MyVersion & ")"
Set rsY = my_Conn.Execute (strSql)
rsY.MoveFirst
while not rsY.EOF
Response.Write rsY("F_VERSION") & "<br />"
rsY.MoveNext
wend
rsY.Close
end if

I am trying to put into this statement.
Code:

strSql = "SELECT FC.ID, FC.F_CAT, COUNT(FF.ID) AS CountOfID "
strSql = strSql & "FROM " & strTablePrefix & "FILECAT FC "
strSql = strSql & "LEFT JOIN " & strTablePrefix & "FILEMANAGER FF "
strSql = strSql & "ON FC.ID = FF.F_CAT "
strSql = strSql & "GROUP BY FC.F_CAT, FC.ID"

I want to take the forum version which in the database is called Free and put it into the above statement.
I think it needs to look something like this?
Code:

if strSql = "SELECT F_VERSION "
strSql = strSql & "WHERE ID IN = Free"
then
strSql = "SELECT FC.ID, FC.F_CAT, COUNT(FF.ID) AS CountOfID "
strSql = strSql & "FROM " & strTablePrefix & "FILECAT FC "
strSql = strSql & "LEFT JOIN " & strTablePrefix & "FILEMANAGER FF "
strSql = strSql & "ON FC.ID = FF.F_CAT "
strSql = strSql & "GROUP BY FC.F_CAT, FC.ID"

How would I put that into the SQL Statement?<
JJenson
16 September 2007, 09:54


OK so looking at this closer and closer I think I don't need the if statement at all I just need to get all the strsql statements correct.

I tried this the page shows but it is not limiting the free section to just the files marked as free this is the code I have:

Code:

strSql = "SELECT F_VERSION "
strSql = strSql & "WHERE ID IN Free"
strSql = "SELECT FC.ID, FC.F_CAT, COUNT(FF.ID) AS CountOfID "
strSql = strSql & "FROM " & strTablePrefix & "FILECAT FC "
strSql = strSql & "LEFT JOIN " & strTablePrefix & "FILEMANAGER FF "
strSql = strSql & "ON FC.ID = FF.F_CAT "
strSql = strSql & "GROUP BY FC.F_CAT, FC.ID"

<
JJenson
16 September 2007, 13:14


Ok so with the help of some others I changed up how I am doing this and have the query's running right now I just need to get me SQL statments right.

Here is what I have:
Code:

strSql = "SELECT FORUM_FC.ID, FORUM_FC.F_CAT, COUNT(FORUM_FILEMANAGER.ID) AS COUNTOFID "
strSql = strSql & "FROM " & strTablePrefix & "FILECAT FC "
strSql = strSql & "INNER JOIN " & strTablePrefix & "FILEMANAGER "
strSql = strSql & "FORUM_FC.ID = FORUM_FILEMANAGER.F_CAT "
strSql = strSql & "WHERE FORUM_FILEMANAGER.ISFREE = 1 "
strSql = strSql & "GROUP BY FORUM_FC.F_CAT, FORUM_FC.ID"

This is the error I get with that any ideas?
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
[MySQL][ODBC 3.51 Driver][mysqld-4.1.20-max-log]You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '.ID = FORUM_FILEMANAGER.F_CAT WHERE FORUM_FILEMANAGER.ISFREE = 1 GROUP BY FORUM_' at line 1

/forum/file_library.asp, line 408

ANyone know how I can change this?
Thanks
<
JJenson
16 September 2007, 13:33


OK got it this is the code that works:

Code:

strSql = "SELECT FC.ID, FC.F_CAT, COUNT(FF.ID) AS COUNTOFID "
strSql = strSql & "FROM " & strTablePrefix & "FILECAT FC "
strSql = strSql & "INNER JOIN " & strTablePrefix & "FILEMANAGER FF "
strSql = strSql & "ON FC.ID = FF.F_CAT "
strSql = strSql & "WHERE FF.ISFREE = 1 "
strSql = strSql & "GROUP BY FC.F_CAT, FC.ID "
<
JJenson
17 September 2007, 21:39


Hmm strange works on some but not others. WIll have a look at it. I mean some categories are showing right and others are not showing correct.

Thanks<
JJenson
17 September 2007, 22:53


Fixed now my only problem is with my sql where clause to only show what I need it to show I have posted it here.
http://forum.snitz.com/forum/topic.asp?TOPIC_ID=65601

Thanks<
© 2000-2021 Snitz™ Communications