PDA

View Full Version : Using query strings in regards to mySql database


carol
04-20-2003, 03:53 AM
Hi i would really appreciate any advice

I am trying to buid a site that uses a hyperlink combined with a query string to pass the information to another asp page

<a href = "showcase.asp?fldShowID=<% = oRS("fldShowID")%>">Veiw this showcase Item

Now this seems to be passing the item to the next asp page but i am using this code to try and access the fields i need by comparing the value of the fldShowID query string value to the Mysql database field of the same name

<% fldShowID = request.querystring("fldShowID")%>
<%dim sql
sql = "SELECT tblshowcase.fldShowID, tblshowcase.fldShowID, tblshowcase.fldShowDescription FROM tblshowcase"
sql = SQL & "WHERE fldShowID = ' " & fldShowID & " ' "
oRS.open sql ,CS %>
<%=oRS("fldShowName")%>
<% = oRS("fldShowDesc")%>

I am using a include file for the database connection that has been tested and works fine

oRS is the recordset
CS is the database connection

I have 2 questions:

First i would like to know as the database field is an autonumber of type int is a query string the right way to pass over the information. And if not how should it be done

Second i seem to have a syntax error in my where clause.(is that because of the query string i am using)

Any help would be greatly appreciated

oracleguy
04-20-2003, 04:38 AM
If flshShowID is a number then you don't need single quotes around it, and besides there shouldn't be a space between your single quote and the double like you have on your SQL statement.

That should clear up your syntax error.

carol
04-21-2003, 07:12 AM
Thank you oracle guy

I now have that peice of code working properly and yes it was just the spaces and the ' for a number type that was wrong

So thanks for your help