Print Page | Close Window

SQL location

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=5137
Printed Date: 30 March 2026 at 7:46pm
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: SQL location
Posted By: Aumuz
Subject: SQL location
Date Posted: 19 August 2003 at 9:55pm

I am working on somthing were I have 3 files.

config.asp

check_user.asp

skin.asp

They are all located withing the same folder, and are included into the sites default page in the order I gave them.

The thing is, I would like to have the following statment in my config.asp...

SQL_set_skin="SELECT table_skin.* FROM table_skin WHERE skin_name='" & user_skin & "';"

The problem is, user_skin is not set untill check_user.asp, so I need to have it in skin.asp.

Is there anyway I can do this?




Replies:
Posted By: farrukh
Date Posted: 20 August 2003 at 2:16am
make a default skin
user_skin = yourdefaultskin.asp

SQL_set_skin="SELECT table_skin.* FROM table_skin WHERE skin_name='" & user_skin & "';"

check out the records if found then use user skin else use default skin


-------------
i have collected some nice avatars (37) and smileys (227) here you can download
http://www24.brinkster.com/webmastertool/download.html


Posted By: Aumuz
Date Posted: 20 August 2003 at 6:57am

I don't understand what you mean...



Posted By: Bliss
Date Posted: 20 August 2003 at 10:21am

If you use Farrukh's way, the skin will be reset every time. Just do

If user_skin NOT = "" Then

SQL_set_skin="SELECT table_skin.* FROM table_skin WHERE skin_name='" default "';"

Else

SQL_set_skin="SELECT table_skin.* FROM table_skin WHERE skin_name='" & user_skin & "';"

End If



-------------
Hehehe...


Posted By: Aumuz
Date Posted: 20 August 2003 at 10:29am

I already knew this... This has nothing to do with my question.

What I want to do is place all my SQL's in the config.asp.

I was only using the skin as a example of a problem... That problem being a value of the SQL being set after the config.asp.

A default skin has nothing to do with my question.



Posted By: Aumuz
Date Posted: 20 August 2003 at 12:56pm

Solved my problem...

config.asp

<%

sub user_SQL()

 SQL_set_skin="SELECT table_skin.* FROM table_skin WHERE skin_name='" & user_skin & "';"

 OTHERSQLS

end sub

%>

skin.asp

<%

call user_SQL()

site_reocrd.open SQL_set_skin, site_data

%>

It works well but is there a better way of doing it?



Posted By: Aumuz
Date Posted: 22 August 2003 at 10:13pm

Ok, I found a even better way...

<%

function call_SQL(text)

select case text
 case "skin" call_SQL="SELECT table_skin.* FROM table_skin WHERE skin_name='" & user_skin & "';"end select

end function

%>

<% record.open call_SQL("skin"), data %>

This makes thing a bit cleaner.

Again, if anyone can help me improve this code... I would love the help.

Thanks.




Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net