c p c
07-21-2003, 06:00 AM
Hey,
I am having a bit of trouble when trying to use a hyperlink to generate slected results from my database.
The asp page (offers.asp) lists all the info from the DB fine, but I want to have a choice of maufacturer on a HTML page linking to offers.asp?make=mazda etc etc. I've tried a few things and i either get errors or just the complete list. Any help appreciated. I know i need to do something with the SELECT statement but cant work it out. Heres the code.
<%
Set myConnection = Server.CreateObject("ADODB.Connection")
myConnection.Open "DRIVER=Microsoft Access Driver (*.mdb);DBQ=" &Server.MapPath("mydatabase.mdb") & ";user=;PASSWORD="
'sqlquery = "SELECT * FROM table_offers WHERE make =" & Request.QueryString("make") & ";"
sqlquery = "SELECT * FROM table_offers;"
Set rsOffers = myConnection.Execute(sqlquery)
count=0
Do While Not rsOffers.EOF
%>
<% 'cycle thru the record set and display each row results
'do until rsOffers.EOF %>
<%=Request("make")%>
<!--<TR>
<TD CLASS="title2" HEIGHT=25 VALIGN="top"><%= rsOffers("make") %></TD>
</TR>
<TR>
<TD CLASS="title2" HEIGHT=25 VALIGN="top"><%= rsOffers("model") %></TD>
</TR>
<TR>
<TD VALIGN="top"><IMG SRC="images/<%= rsOffers("image") %>"><BR><BR></TD>
</TR>
<TR>
<TD CLASS="content"><%= rsOffers("description") %><BR><BR></TD>
</TR>
<TR>
<TD CLASS="content">Contact <a href="mailto:<%= rsOffers("email") %>"><%= rsOffers("email") %><BR><BR></TD>
</TR>
<TR>
<TD CLASS="content">Or Phone <%= rsOffers("phone") %><BR><BR></TD>
</TR>
<TR>
<TD ALIGN="center" HEIGHT=50><IMG SRC="images/jobgap.gif" WIDTH=400 HEIGHT=2 BORDER=0></TD>
</TR>-->
<%
'increment record position with MoveNext method
rsOffers.MoveNext
loop
'close the recordset and flush object from memory
rsOffers.Close
set rsOffers = Nothing
%>
I am having a bit of trouble when trying to use a hyperlink to generate slected results from my database.
The asp page (offers.asp) lists all the info from the DB fine, but I want to have a choice of maufacturer on a HTML page linking to offers.asp?make=mazda etc etc. I've tried a few things and i either get errors or just the complete list. Any help appreciated. I know i need to do something with the SELECT statement but cant work it out. Heres the code.
<%
Set myConnection = Server.CreateObject("ADODB.Connection")
myConnection.Open "DRIVER=Microsoft Access Driver (*.mdb);DBQ=" &Server.MapPath("mydatabase.mdb") & ";user=;PASSWORD="
'sqlquery = "SELECT * FROM table_offers WHERE make =" & Request.QueryString("make") & ";"
sqlquery = "SELECT * FROM table_offers;"
Set rsOffers = myConnection.Execute(sqlquery)
count=0
Do While Not rsOffers.EOF
%>
<% 'cycle thru the record set and display each row results
'do until rsOffers.EOF %>
<%=Request("make")%>
<!--<TR>
<TD CLASS="title2" HEIGHT=25 VALIGN="top"><%= rsOffers("make") %></TD>
</TR>
<TR>
<TD CLASS="title2" HEIGHT=25 VALIGN="top"><%= rsOffers("model") %></TD>
</TR>
<TR>
<TD VALIGN="top"><IMG SRC="images/<%= rsOffers("image") %>"><BR><BR></TD>
</TR>
<TR>
<TD CLASS="content"><%= rsOffers("description") %><BR><BR></TD>
</TR>
<TR>
<TD CLASS="content">Contact <a href="mailto:<%= rsOffers("email") %>"><%= rsOffers("email") %><BR><BR></TD>
</TR>
<TR>
<TD CLASS="content">Or Phone <%= rsOffers("phone") %><BR><BR></TD>
</TR>
<TR>
<TD ALIGN="center" HEIGHT=50><IMG SRC="images/jobgap.gif" WIDTH=400 HEIGHT=2 BORDER=0></TD>
</TR>-->
<%
'increment record position with MoveNext method
rsOffers.MoveNext
loop
'close the recordset and flush object from memory
rsOffers.Close
set rsOffers = Nothing
%>