I am coding simple 404 seo for my website. I am little confused at one point. I need codes to go over categories table and see if it matches with the string. If yes, then it should print category’s name, if not then it should display “page not found” message. I dont understand where I went wrong here…
> > <%
> > WebsiteQueryString = Request.QueryString
> > SplitQueryString = split(WebsiteQueryString, "/")
> >
> > SQL = "SELECT C.CATEGORYID,
> > C.CATEGORYNAME" SQL = SQL & " FROM
> > CATEGORIES C" Set objCategory =
> > objConn.Execute(SQL)
> >
> > If objCategory("CATEGORYID") =
> > SplitQueryString(4) Then %>
> >
> > <%=objCategory("CATEGORYNAME")%>
> >
> > <% Else %>
> >
>
> enter code here`page not found.
>
> >
> >
> > <% End If %>
Some hints:
1/ use cInt (or cStr)
If
SplitQueryString(4)is a number, try puttingcInt(before both operands as inIf have come across situations where I needed to do this to have a good comparison.
2/ try writing the values on screen before you compare them (are you sure you are comparing with the correct element ?)
I always put brackets around them as to see if an empty string is present
3/ Test for IsNull()
Try testing for IsNull() for your
objCategory("CATEGORYID"), since I think field values are Null if not present in the record4/ Make sure you use the correct field name (CATEGORYID) – check spelling