<% Dim sConnection, objConn , objCats,objCatCount, objPics, objPicsCats , catCount sConnection = "DRIVER={MySQL ODBC 3.51 Driver}; SERVER=mysql15.ixwebhosting.com; DATABASE=DaveC42_Illo; UID=DaveC42_user1;PASSWORD=z0db0n; OPTION=3" Set objConn = Server.CreateObject("ADODB.Connection") objConn.Open(sConnection) Set objCatCount = objConn.Execute("SELECT COUNT(*) FROM tblCategories") catCount = CINT(objCatCount.Fields.Item(0)) %> home


>Select All/None <% 'render Category tickyboxes Set objCats = objConn.Execute("SELECT * FROM tblCategories") cid = 1 While Not objCats.EOF %> ><%= objCats.Fields("Name") %> <% objCats.MoveNext cid=cid+1 Wend %>


<% 'construct query for requested categories sqlSTR = "" for cat = 1 to catCount tmpID = CInt(Request.QueryString("chk" & cat)) if tmpID = cat then sqlSTR = sqlSTR & "Category=" & cat & " OR " end if next if len(sqlSTR) > 0 then 'categories specified, construct SQL sqlSTR = sqlSTR & "0" sqlSTR = "SELECT DISTINCT * FROM tblPics WHERE id IN ( SELECT Pic FROM tblPicsCategories WHERE " & sqlSTR & ")" Set objPics = objConn.Execute(sqlSTR ) else ' no category requested - return all Set objPics = objConn.Execute("SELECT * FROM tblPics") end if %> <% 'render thumbs pid=1 While Not objPics.EOF picParams = chr(39) & objPics.Fields("FilePath") & chr(39) & "," &_ chr(39) & OutputString(objPics.Fields("Name")) & chr(39) & "," &_ chr(39) & OutputString(objPics.Fields("Description")) & chr(39) Response.Write "  & chr(34) & objPics.Fields(" & chr(13) objPics.MoveNext pid = pid+1 Wend objPics.Close : Set objRS = Nothing objConn.Close : Set objConn = Nothing function isTickyTicked(whatTicky) if Request.QueryString("chk" & whatTicky) = cStr(whatTicky) then isTickyTicked = "checked='checked'" else isTickyTicked = "" end if end function function OutputString(input) tmp = input tmp = Replace(tmp, chr(39), "\'") tmp = Replace(tmp, chr(34), "\'") OutputString = tmp end function %>