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)
 passing names to query
 New Topic  Topic Locked
 Printer Friendly
Previous Page | Next Page
Author Previous Topic Topic Next Topic
Page: of 6

Alfred
Senior Member

USA
1527 Posts

Posted - 05 August 2003 :  17:26:38  Show Profile  Visit Alfred's Homepage
Both are updated, but still only show Rommel, and with 4 medals.

Alfred
The Battle Group
CREDO
Go to Top of Page

laser
Advanced Member

Australia
3859 Posts

Posted - 05 August 2003 :  18:07:02  Show Profile
****, I was trying to avoid that but it slipped in at the end.

Trick question : Do you intend to use the medals the size they are now ?, or change their size/name for this page later on to suit the current (static) page ?

I think the problem lies in the inner join. It would work a lot easier/better if you used the DisplayMedalIcon function, or a customised version on this page. I'm trying to future-proof this, so even a database redesign is in order (depending on the answers above). So, can you answer these :

- Does your database currently hold the medal names, or is it all done in code ?
- Will ALL medals on ALL pages be the same size & filename for the same medalid ?
- Or if not, how many different sizes of the one medal is there ?

more questions to come later, but they will do for now
Go to Top of Page

Alfred
Senior Member

USA
1527 Posts

Posted - 05 August 2003 :  18:43:23  Show Profile  Visit Alfred's Homepage
Trick question : Do you intend to use the medals the size they are now ?, or change their size/name for this page later on to suit the current (static) page ?
I was going to change the size in the code to suit the page.
I think the problem lies in the inner join. It would work a lot easier/better if you used the DisplayMedalIcon function, or a customised version on this page. I'm trying to future-proof this, so even a database redesign is in order (depending on the answers above). So, can you answer these :

- Does your database currently hold the medal names, or is it all done in code ?
One table (medals) holds the medal names, the other (membr_medals) holds the medal IDs.
- Will ALL medals on ALL pages be the same size & filename for the same medalid ?
I need different sizes, but they can all be using the same img names.
- Or if not, how many different sizes of the one medal is there?
Only two right now. All except the "decorated" page are the tiny one.

more questions to come later, but they will do for now
[/quote]

Alfred
The Battle Group
CREDO
Go to Top of Page

laser
Advanced Member

Australia
3859 Posts

Posted - 05 August 2003 :  23:38:30  Show Profile
Ooops, just realised I brought up the rude-word filter in my last post, it wasn't that bad I assure you

Anyway, you say that the table stores the medal names - is this the filename ? If so, do we need them in the code all the time ?

You say that the same medal can be different sizes, but the same filename. How many diff sizes, only large and small ?

Anyway, I think the easier way to write this is an altered form of your existing function. Try this :

- paste your function code into the decorated2, just after the config.asp include (make sure you get the <% and %> correct)

- You really only need the memberid and membername from the existing SQL. Leave it as is at the moment, but I fully expect to see a lot of duplicates.

- Change the inside of the While so you are referencing the function at the top of the page. This way you can grab all the medals for a member at once.


OK, if you get to here and everything is working then attempt this :

- in the SQL statement that was originally there, change this line :

strSql = "SELECT M.MEMBER_ID, M.MEDAL_ID, M1.M_NAME " & _

to this

strSql = "SELECT DISTINCT M.MEMBER_ID, M1.M_NAME " & _


Let me know how it goes, and where you got to.
Go to Top of Page

Alfred
Senior Member

USA
1527 Posts

Posted - 06 August 2003 :  11:11:15  Show Profile  Visit Alfred's Homepage
Anyway, you say that the table stores the medal names - is this the filename ?
No, they are not (if you mean the file names of the images).

If so, do we need them in the code all the time ?
That I do not know.

You say that the same medal can be different sizes, but the same filename. How many diff sizes, only large and small ?
At this point we only have used two sizes.

Alfred
The Battle Group
CREDO
Go to Top of Page

laser
Advanced Member

Australia
3859 Posts

Posted - 06 August 2003 :  19:10:27  Show Profile
OK, but any progress on the "try this" section ??
quote:

- paste your function code into the decorated2, just after the config.asp include (make sure you get the <% and %> correct)

- You really only need the memberid and membername from the existing SQL. Leave it as is at the moment, but I fully expect to see a lot of duplicates.

- Change the inside of the While so you are referencing the function at the top of the page. This way you can grab all the medals for a member at once.


OK, if you get to here and everything is working then attempt this :

- in the SQL statement that was originally there, change this line :

strSql = "SELECT M.MEMBER_ID, M.MEDAL_ID, M1.M_NAME " & _

to this

strSql = "SELECT DISTINCT M.MEMBER_ID, M1.M_NAME " & _


Let me know how it goes, and where you got to.

Go to Top of Page

Alfred
Senior Member

USA
1527 Posts

Posted - 07 August 2003 :  00:25:31  Show Profile  Visit Alfred's Homepage
I am not sure what you mean by that.
Isn't that where we have it right now anyway?:
quote:
<!--#INCLUDE FILE="config.asp"-->

<%
set my_Conn = Server.CreateObject("ADODB.Connection")
my_Conn.Open strConnString

strSql = "SELECT M.MEMBER_ID, M.MEDAL_ID, M1.M_NAME " & _
"FROM MEMBER_MEDALS M " & _
"INNER JOIN FORUM_MEMBERS M1 ON M1.MEMBER_ID = M.MEMBER_ID order by m_name asc;"
set myMedals = my_Conn.Execute(strSql)

currid = mymedals("m_name")

while not myMedals.bof and not myMedals.eof


Alfred
The Battle Group
CREDO
Go to Top of Page

laser
Advanced Member

Australia
3859 Posts

Posted - 07 August 2003 :  00:51:01  Show Profile
quote:
Isn't that where we have it right now anyway?:

Not quite - (a) what you have now is an inner join that returns multiple records per member, each with a single medal number. You can get it to work, but it's probably easier to do it this way :

(b) Have the query return a SINGLE record per member, and then call a function to return all the medal imgs in one go.

What you have now is (a), what I think you need is (b) - the coding should be simpler to start with. So what you need to do is follow these steps :

1) Take a copy of decorated2.asp and call it decorated3.asp
2) Open your DisplayMedalIcon.inc file, take a copy of the contents, and paste all the text immediately after the config.asp line in decorated3.asp (make sure you get the <% and %> correct)
3) Delete everything between the While and Wend lines
4) Between the While and Wend lines, create a new line and call the function you created at the top (Step 2 in this post) passing the memberid to it. I think the code would be something like this :

Response.Write DisplayMedalIcon(mymedals("member_id"))

That should be closer to working, but maybe not quite right. If you get to here with no errors and feel like continuing, try this :

5) in the SQL statement that was originally there, change this line :

strSql = "SELECT M.MEMBER_ID, M.MEDAL_ID, M1.M_NAME " & _

to this

strSql = "SELECT DISTINCT M.MEMBER_ID, M1.M_NAME " & _


Step 5 should eliminate all the repeating rows you have.

Again, if you strike trouble I/we need txt & asp files and a description of what went wrong where.
Go to Top of Page

Alfred
Senior Member

USA
1527 Posts

Posted - 07 August 2003 :  13:26:12  Show Profile  Visit Alfred's Homepage
quote:
If you get to here with no errors
Dreaming...
I went through the steps as well as I understood, and uploaded decorated3 in asp and txt format.

Alfred
The Battle Group
CREDO
Go to Top of Page

laser
Advanced Member

Australia
3859 Posts

Posted - 07 August 2003 :  17:09:46  Show Profile
Alfred, you have to help me/us so you can get help. The decorated3.asp & decorated3.txt files are not the same.

Using my crystal ball, line 6 in decorated3.asp is:

while

but it should be

while not myMedals.bof and not myMedals.eof


but if you've just pasted a MULTIline function before it, there's no way it can be line 6.
Go to Top of Page

Alfred
Senior Member

USA
1527 Posts

Posted - 07 August 2003 :  21:35:27  Show Profile  Visit Alfred's Homepage
Sorry if I screwed that up.
I deleted all the stuff from the file now that I think you wanted me to take out, but I wasn't sure (still ain't!).
What I am sure about now is that both, asp and txt files were saved without differences in them.

Alfred
The Battle Group
CREDO
Go to Top of Page

laser
Advanced Member

Australia
3859 Posts

Posted - 08 August 2003 :  05:23:15  Show Profile
Can you go back to decorated2 and start again ?

Let's just try the first two steps :

1) Take a copy of decorated2.asp and call it decorated3.asp
2) Open your DisplayMedalIcon.inc file, take a copy of the contents, and paste all the text immediately after the config.asp line in decorated3.asp (make sure you get the <% and %> correct)

Let me know when that's done and we'll get it right before we continue. The ASP file WON'T work differently after these changes, so I can only check the txt file changes.
Go to Top of Page

Alfred
Senior Member

USA
1527 Posts

Posted - 08 August 2003 :  11:55:42  Show Profile  Visit Alfred's Homepage
Originally posted by laser

Can you go back to decorated2 and start again ?
Let's just try the first two steps :

1) Take a copy of decorated2.asp and call it decorated3.asp
Check!
2) Open your DisplayMedalIcon.inc file
We do not have a file by that name. Assuming you mean the file that contains the code of the function, I'll use that one.

take a copy of the contents, and paste all the text immediately after the config.asp line in decorated3.asp (make sure you get the <% and %> correct)
Check.

Let me know when that's done and we'll get it right before we continue. The ASP file WON'T work differently after these changes, so I can only check the txt file changes.
...and uploaded in asp and txt versions.

Alfred
The Battle Group
CREDO
Go to Top of Page

laser
Advanced Member

Australia
3859 Posts

Posted - 08 August 2003 :  17:52:26  Show Profile
Check!
Next step :

3) Delete everything between the While and Wend lines

That means this while :

while not myMedals.bof and not myMedals.eof

not the other while.

Edited by - laser on 08 August 2003 17:53:37
Go to Top of Page

Alfred
Senior Member

USA
1527 Posts

Posted - 08 August 2003 :  19:31:21  Show Profile  Visit Alfred's Homepage
Done!
and updated!

Alfred
The Battle Group
CREDO
Go to Top of Page
Page: of 6 Previous Topic Topic Next Topic  
Previous Page | Next Page
 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.32 seconds. Powered By: Snitz Forums 2000 Version 3.4.07