sono riuscito a far funzionare la ricerca.. http://www10.asphost4free.com/aspasp...go_ricerca.asp
(ma...), ecco il codice:
codice:
<% response.buffer=true %>
<% Server.ScriptTimeout = 300 %>
<%
dim objConn
set objConn = server.createobject("ADODB.Connection")
objConn.open "Provider = Microsoft.Jet.OLEDB.4.0; Data Source = "&_
Server.MapPath("mdb-database\ecom.mdb")
sel_ses = request.form("Prodotto")
sel_reg = request.form("PDescrizione")
sel_prov = request.form("CPrezzo")
Dim strRicerca
if sel_ses = "" and sel_reg = "Tutte" and sel_prov = "Tutte" then
strRicerca = " ORDER BY ID"
else
if sel_ses = "" and sel_reg <> "Tutte" and sel_prov = "Tutte" then
strRicerca = " WHERE [Regione residenza] = '"& sel_reg &"' ORDER BY ID"
else
if sel_ses <> "" and sel_reg = "Tutte" and sel_prov = "Tutte" then
strRicerca = " WHERE Prodotto = '"& sel_ses &"' ORDER BY ID"
else
if sel_ses <> "" and sel_reg <> "Tutte" and sel_prov = "Tutte" then
strRicerca = " WHERE Prodotto ='"& sel_ses &"' AND [Regione residenza] ='"& sel_reg &"' ORDER BY ID"
else
if sel_ses <> "" and sel_reg <> "Tutte" and sel_prov <> "Tutte" then
strRicerca = " WHERE Prodotto = '"& sel_ses &"' AND [Regione residenza] ='"& sel_reg & "' AND [Provincia residenza] ='"& sel_prov & "' ORDER BY ID"
end if
end if
end if
end if
end if
iPageSize = 2 'NUMERO RECORD PER PAGINA
If Request.QueryString("page") = "" Then
iPageCurrent = 1
Else
iPageCurrent = CInt(Request.QueryString("page"))
End If
dim objRS, strSQL
set objRS = server.createobject("ADODB.Recordset")
strSQL = "SELECT * FROM Prodotti"
strSQL = strSQL & strRicerca
objRS.PageSize = iPageSize
objRS.CacheSize = iPageSize
objRS.open strSQL, objConn, adOpenStatic, adLockReadOnly, adCmdText
reccount = objRS.recordcount
iPageCount = objRS.PageCount
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
@import url("ley_2.css");
a#viewcss{color: #00f;font-weight: bold}
</style>
<script type="text/javascript" src="script_regioni.js">
</script>
</head>
<body>
<table cellpadding="0" cellspacing="0" border="0" width="95%">
<tr>
<td bgcolor="#cccccc">
<table cellpadding="2" cellspacing="1" border="0" width="100%">
<%If iPageCurrent > iPageCount Then iPageCurrent = iPageCount
If iPageCurrent < 1 Then iPageCurrent = 1
If iPageCount = 0 Then
Response.Write "
<table><td><font face='verdana' size='2' color='#000000'>Nessuna ricerca per le tue scelte.</td></table></p>"
Else
objRS.AbsolutePage = iPageCurrent
iRecordsShown = 0
%>
<%
'SI VISUALIZZA IL CONTENUTO DELLA STRINGA SQL
'ALL'INTERNO DELLA TABELLA PRIMA DEFINITA
cont=1
Do While iRecordsShown < iPageSize And Not objRS.EOF
Dim Rig, bg
Rig = Rig + 1
If Rig Mod 2 = 0 then
bg = "#E4E4E4"
Else
bg = "#ccccff"
End if
Response.Write "<tr bgcolor = " & bg & "><td><font color='#000000' face='Verdana' size='1'>" & (iPageSize*iPageCurrent)-iPageSize+Cont & "</font></td>"
Response.Write "<td>"%><a href="scheda.asp?id=<%=objRS("ID")%>">
<%Prodotto=objRS("Prodotto")%><img border="0" width="100" height="100" src="../
<%
If objRS("PFoto") <> ("public/imgprodotti/") Then
Response.Write objRS("PFoto")
Else
Response.Write Img_NonDisponibile_P
End If
%>
"></td>
<%
Response.Write "<td align='center'><font color='#000000' face='Verdana' size='1'>"%><a href="scheda.asp?id=<%=objRS("ID")%>"><%=objRS("Prodotto")%></font></td>
<%
Response.Write "<td align='center'><font color='#000000' face='Verdana' size='1'>" & objRS("PDescrizione") & "</font></td>"
Cont = Cont + 1
'POSIZIONAMENTO ALLA RIGA SUCCESSIVA DEL DB
iRecordsShown = iRecordsShown + 1
objRS.MoveNext
Loop
'PULIZIA DEGLI OGGETTI ADO
objRS.Close
Set objRS = Nothing
%>
</table>
</td>
</tr>
</table>
<%End if%>
<%If ipagecount <> 1 Then%>
<center>
<table>
<tr valign="middle">
<td width="50%" align="center" valign="middle"><font face="verdana" size="1" color="#000000">
[
<%if iPageCurrent-2 > 0 and iPageCurrent > 2 then%>
[img]images/first.gif[/img]
<%end if%>
<%if iPageCurrent > 1 then%>
[img]images/pre.gif[/img]
<%end if%>
<%if iPageCount > 2 then
if iPageCurrent-2 < 1 then da_pag = 1 else da_pag = iPageCurrent-2
if iPageCurrent+2 > iPageCount then fino_a_pag = iPageCount else fino_a_pag = iPageCurrent+2
else
da_pag = 1
fino_a_pag = iPageCount
end if%>
<%for i = da_pag to fino_a_pag%>
<%if i = iPageCurrent then%>
<font color="red"><%=i%></font>
<%else%>
<%=i%>
<%end if%>
<%next%>
<%if iPageCurrent > 0 and iPageCurrent < iPageCount then%>
[img]images/next.gif[/img]
<%end if%>
<%if iPageCurrent+1 < iPageCount then%>
[img]images/last.gif[/img]
<%end if%>
]
</font></td>
</tr>
<tr>
<td colspan="2" align="center"><font face="verdana" size="1" color="#000000">
<center>
Pagina
<font color="#FF0000"><%=iPageCurrent%></font>
di
<font color="#FF0000"><%=iPageCount%></font>
</center>
</font></td>
</tr>
</table>
</center>
<%end if%>
<%
objConn.Close
Set objConn = Nothing
%>
</body>
</html>
codice:
<form name="form1" method="post" onSubmit="return controllaRICERCA(this)" action="catalogo_ricerca.asp">
<tr>
<td><font size="+1">Ricerca nel sito</font></td>
</tr>
<tr>
<td><font size="1">inserisci i termini per la ricerca</font></td>
</tr>
<tr>
<td height="5">[img]images/puntino_trasparente.gif[/img]</td>
</tr>
<tr>
<td><font size="1">cerca in:</font></td>
</tr>
<tr>
<td><select name="Prodotti" >
<option value="Prodotti">Tutti i tipi</option>
<option value="Appartamento">Appartamenti</option>
<option value="Villa">Ville</option>
<option value="Rustico">Rustici</option>
</select>
<font size="1">Tipologia
</font></td>
</tr>
<tr>
<td>
<input type="submit" name="Submit2" value="[VAI]" style="BACKGROUND-COLOR: #ffffff; BORDER-BOTTOM: #537db9 0px; BORDER-LEFT: #537db9 0px; BORDER-RIGHT: #537db9 0px; BORDER-TOP: #537db9 0px; COLOR: #000000; FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif; FONT-SIZE: 10px; FONT-STYLE: normal; LINE-HEIGHT: normal">
</td>
</tr>
</form>
se clicco su "Tutti i tipi" o "Appartamenti" e così via gli altri.. mi trova sempre gli stessi risultati.
Io voglio che quando clicco su "Appartamento" mi trovi come risultati tutti gli appartamenti e così via..
il mio db è così strutturato: http://www10.asphost4free.com/aspasp/db.jpg
So che dovrei cambiare la struttura del db ma cambiandola non mi ritrovo più per l inserimento dei prodotti.
chi mi da una mano a creare il form e fare ricerche specifiche?