29. marts 2006 - 20:51Der er
11 kommentarer og 1 løsning
Udtræk
<% If (IsNumeric(Request.QueryString("id"))) And (Request.QueryString("id") <> "") Then If Request.QueryString("id") < 1 Then intINPUT = 1 else If Request.QueryString("id") > antalcoms.Fields("antalcomsREF") Then intINPUT = antalcoms.Fields("antalcomsREF") end if intINPUT = Request.QueryString("id") end if End if %>
Problemet er at jeg får en error når id > antalcoms.fields... istedet for at intINPUT sættes til antalcoms.fileds...
ok så prøv at bruge variablen no i if sætningen hvis du får lukket for antalcoms igen if sætnignen:
<% If (IsNumeric(Request.QueryString("id"))) And (Request.QueryString("id") <> "") Then If Request.QueryString("id") < 1 Then intINPUT = 1 else If Request.QueryString("id") > no Then intINPUT = no end if intINPUT = Request.QueryString("id") end if End if %>
ARH det er i if sætningen den er gal den vil altid sætte id til request.Quersyting da du har en end if skulle være en else så prøv lige sådan her:
<% If (IsNumeric(Request.QueryString("id"))) And (Request.QueryString("id") <> "") Then If Request.QueryString("id") < 1 Then intINPUT = 1 else If int(Request.QueryString("id")) > int(no) Then intINPUT = no else intINPUT = Request.QueryString("id") end if end if End if %>
<% Set Conn = Server.CreateObject("ADODB.Connection") strDSN = "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & Server.MapPath("../database/popp.mdb") Conn.Open strDSN set antalcoms = Conn.Execute ("SELECT count(id) AS antalcomsREF FROM po") no = antalcoms.Fields("antalcomsREF")
If (IsNumeric(Request.QueryString("id"))) And (Request.QueryString("id") <> "") Then If Request.QueryString("id") < 1 Then intINPUT = 1 else If int(Request.QueryString("id")) > int(no) Then intINPUT = no end if intINPUT = Request.QueryString("id") end if End if Conn.Close set Conn=nothing%>
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.