[thelist] SQL problem

Kevin Stevens kjs at ratking.co.uk
Fri Aug 16 08:26:01 CDT 2002


> In another database, or table? I don't think that you have given us enough
> info to solve the situation. Are there two tables, two table in two
> databases, or something else? Can you describe the tables?

OK, sorry, I think I've been getting my jargon wrong. I have 2 tables, 1
called Descs which contains just two columns...

PKey ¦ Catagory
-----------------------------------
1       ¦ Music
2       ¦ Humour
3       ¦ Computer stuff

and a second table called FaveList which contains

Primary_ID ¦ pkmatch ¦ Description
----------------------------------------------------------------------------
1               ¦ 1            ¦ Cardiacs Homepage
2               ¦ 1            ¦ Offspring Homepage
3               ¦ 2            ¦ Popbitch
4               ¦ 3            ¦ Evolt

What I am trying to do here is put all the contents of my Favourites folder
on-line so I can access them wherever I am. So the idea is to print the
catagory and then populate a dropdown box next to it with anything that
matches PKey with pkmatch and display the results using PKey in ascending
order. Here's the relevant code...

set RSPKey = conn.execute ("select PKey from Descs")
do until RSPkey.eof = true
set PKey = (RSPKey("PKey"))

set RSDesc = conn.execute ("select Catagory from Descs")
do until RSDesc.eof = true

response.write "<table border=1 cellspacing=10 cellpadding=1>" &"<tr>" &"<td
width=100px>" &(RSDesc("Catagory")) &"</td>"

set RSOptions = conn.execute ("select * from FaveList where pkmatch ="
&PKey)

do until RSOptions.eof
content = content &"<option>" &(RSOptions("Description")) &"</option>"
RSOptions.movenext
loop

RSOptions.close
set RSOptions = nothing
%>

<form method="post" action="siteresult.asp">
<td width="300px">
<select size="1" name="dropdown_menu">
<%=content%>
</select>
</td>
<td>
<input type="submit" value="Go to site">
</td>
</form>
</table>

Hope I've explained myself properly this time :)

Kevin Stevens
kjs at ratking.co.uk




More information about the thelist mailing list