Pagina 1 di 2 1 2 ultimoultimo
Visualizzazione dei risultati da 1 a 10 su 12

Discussione: Order by a z

  1. #1

    Order by a z

    Ciao a tutti ho un sito in asp di annunci #(‬Script# ‬:# ‬Mercatino V.1.0# )sono un appassionato e non un webmaster?‬ , avrei bisogno di mettere le Categorie degli annunci della HomePage in ordine alfabetico dalla A alla Z
    Le sottocategorie sono in ordine alfabetico così:
    <%
    sql = "SELECT * From SotCategorie where CategoriaID='" & cat & "' order by NomeCategoria ASC" ' da A a Z
    set rs = Conn.Execute (sql)
    Else
    End IF
    %>

    Ma questo non è valido per la Homepage, qualcuno mi puo aitare dandomi il codice giusto per la homepage .
    Grazie

  2. #2
    Moderatore di ASP e MS Server L'avatar di Roby_72
    Registrato dal
    Aug 2001
    Messaggi
    19,563
    Vediamo la tua query attuale ed il nome del campo per il quale ordinare.

    Roby

  3. #3

    order by

    Scusami ma mastico poco asp

    intendi la index.asp

  4. #4
    Moderatore di ASP e MS Server L'avatar di Roby_72
    Registrato dal
    Aug 2001
    Messaggi
    19,563
    La "sql" del tuo primo messaggio si definisce query...
    Nella tua index.asp ci sarà quella che è da correggere. Serve vedere come è fatta...

    Roby

  5. #5

    order by

    Ciao, ho tolto delle righe non importanti x spazio,non riesco a inviartela intera il sito è Mercatinoplus
    Grazie




    <p align="left">[img]immagini/ita.gif[/img]<font color="#2376E1" size="5" face="Batang">Italia

    <table border="0">
    <%
    dim id_regione, id_provincia, id_comune

    id_regione = request.querystring("id_regione")
    id_provincia = request.querystring("id_provincia")
    id_comune = request.querystring("id_comune")

    if id_regione ="" then id_regione=request.form("id_regione")
    if id_provincia="" then id_provincia=request.form("id_provincia")
    if id_comune="" then id_comune=request.form("id_comune")


    Dim Myconn, Rs2, sql2, regione, comune
    Set MyConn=Server.CreateObject("ADODB.Connection")
    MyConn.Open "Driver={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.Mappath("/mdb-database/mercatino.mdb")

    'regione=""
    'comune=""

    if id_regione<>"" then
    SQL2 = "Select regione From regioni where id_regione="&id_regione&""
    Set RS2 = MyConn.Execute(SQL2)

    While Not RS2.EOF
    regione=rs2("regione")
    RS2.MoveNext
    Wend
    RS2.Close
    Set RS2 = Nothing
    end if

    if id_provincia<>"" then
    SQL2 = "Select provincia From province where id_provincia="&id_provincia&""
    Set RS2 = MyConn.Execute(SQL2)

    While Not RS2.EOF
    provincia=rs2("provincia")
    RS2.MoveNext
    Wend
    RS2.Close
    Set RS2 = Nothing
    end if

    if id_comune<>"" then
    SQL2 = "Select comune From comuni where id_comune="&id_comune&""
    Set RS2 = MyConn.Execute(SQL2)

    While Not RS2.EOF
    comune=rs2("comune")
    RS2.MoveNext
    Wend
    RS2.Close
    Set RS2 = Nothing
    end if
    %>
    <form method="post" action="?op=filtra"><tr>
    <td>
    <select name="id_regione" id="id_regione" onChange="cerca_province();">
    <%if id_regione<>"" then%>
    <option value="<%=id_regione%>"><%=regione%></option>
    <%end if%>
    <option value="0">Seleziona Regione</option>
    <%

    SQL2 = "Select * From regioni order by regione asc"
    Set RS2 = MyConn.Execute(SQL2)

    While Not RS2.EOF
    %>
    <option value="<%=rs2("id_regione")%>"><%=rs2("regione")%> </option>
    <%
    RS2.MoveNext
    Wend
    RS2.Close
    Set RS2 = Nothing
    MyConn.Close
    Set MyConn = Nothing
    %>
    </select>
    </td>
    </tr>
    <tr>
    <td id="provincia"><select id="id_provincia" name="id_provincia">
    <%if id_provincia<>"" then%>
    <option value="<%=id_provincia%>" selected="selected"><%=provincia%></option>
    <%else%>
    <option value="0" selected="selected">Seleziona la Provincia</option>
    <%end if%>
    </select></td>
    </tr>
    <tr>
    <td id="comuni"><select id="id_comune" name="id_comune">
    <%if id_comune<>"" then%>
    <option value="<%=id_comune%>" selected="selected"><%=comune%></option>
    <%else%>
    <option value="0" selected="selected">Seleziona il Comune</option>
    <%end if%>
    </select></td>
    </tr>
    <tr>
    <td><input type="submit" value="Filtra annunci" /></td>
    </tr></form>
    <tr><td>




    <p align="center"><a href="sitiamici.html">[img]immagini/st.gif[/img][/b]
    <p aling="center">[img]immagini/bgames23.gif[/img]

    </td></tr></table>
    <p align="center">


    <p align="center">


    <td height="378" width="546" align="center" bordercolorlight="#FFFFFF" bgcolor="#FFFFFF" valign="top">

    <table border="0" width="750" cellspacing="0" cellpadding="0" align="center">

    <tr> <td width="100%" valign="top">
    <p align="center">
    </tr>


    <p align="center"><a href="http://www.mercatinoplus.net/cv.html">[img]immagini/bannerlavoro.gif[/img]
    <tr>
    <td valign="top">

    <marquee style="font-size: 14pt; font-family:Batang; color: #ffffff"bgcolor="#ABCDEF" scrollamount="3" direction="left">Consiglio di inserire nei vostri annunci la Regione_Città_Cap </marquee>
    <hr size="1" color="#FF0000">
    <div align="center"><table border="0" width=503>

    <% cat = Request.QueryString("CatID")

    sql = "select * from cat order by id"
    set rs = Conn.Execute (sql)
    IF rs.EOF then
    Response.Write "<center><font color='#838383'>Non sono ancora state create Categorie !!!
    </font>"
    Else
    End IF%>

    <div align="center"><table border="0" width=503>
    <%
    if request.querystring("op")="" then
    %>
    <!--

    Annunci</p>-->
    <%
    else
    Set MyConn=Server.CreateObject("ADODB.Connection")
    MyConn.Open "Driver={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.Mappath("/mdb-database/mercatino.mdb")

    if id_regione<>"" then


    %><p style="text-align: center; font-size: 14pt;">Annunci in zona:
    <%

    SQL2 = "Select * From regioni where id_regione="&id_regione&""
    Set RS2 = MyConn.Execute(SQL2)

    While Not RS2.EOF
    %>
    <%=rs2("regione")%>
    <%
    RS2.MoveNext
    Wend
    RS2.Close
    Set RS2 = Nothing
    %>
    <%
    end if

    if id_provincia<>"" then
    %>
    <%


    SQL2 = "Select * From province where id_provincia="&id_provincia&""
    Set RS2 = MyConn.Execute(SQL2)

    While Not RS2.EOF
    %>
    &gt; <%=rs2("provincia")%>
    <%
    RS2.MoveNext
    Wend
    RS2.Close
    Set RS2 = Nothing
    %>

    <%
    end if

    if id_comune<>"" then
    %>
    <%

    SQL2 = "Select * From comuni where id_comune="&id_comune&""
    Set RS2 = MyConn.Execute(SQL2)

    While Not RS2.EOF
    %>
    &gt; <%=rs2("comune")%>
    <%
    RS2.MoveNext
    Wend
    RS2.Close
    Set RS2 = Nothing
    %>
    <%
    end if
    %></p><%
    end if
    %>
    <%
    Do while NOT rs.EOF
    ColNum = 1
    Do while ColNum < 3
    %>

    <TD ALIGN=LEFT VALIGN=top WIDTH="254">[img]<%=rs([/img]"><font face="Batang" size="2"> &amp;categoria=<%=server.urlencode(rs("cat"))%><%i f request.querystring("op")="filtra" then%>&amp;op=filtra&amp;id_regione=<%=request.for m("id_regione")%>&amp;id_provincia=<%=request.form ("id_provincia")%>&amp;id_comune=<%=request.form(" id_comune")%><%end if%>"><%=rs("cat")%><font face="Arial" size="3"COLOR = "#FF0000">
    <%
    IDCategoria = rs("id")
    if request.querystring("op")="" then
    sqlcount = "SELECT count(Titolo) FROM annunci where IDsottocat='" & IDCategoria & "' and show=yes"
    else
    if request.querystring("op")="filtra" then

    if id_regione<>"" then
    sqlcount = "SELECT count(Titolo) FROM annunci where IDsottocat='" & IDCategoria & "' and show=yes and id_regione="&id_regione&""
    end if
    if id_provincia<>"" then
    sqlcount = "SELECT count(Titolo) FROM annunci where IDsottocat='" & IDCategoria & "' and show=yes and id_provincia="&id_provincia&""
    end if
    if id_comune<>"" then
    sqlcount = "SELECT count(Titolo) FROM annunci where IDsottocat='" & IDCategoria & "' and show=yes and id_comune="&id_comune&""
    end if
    else
    sqlcount = "SELECT count(Titolo) FROM annunci where IDsottocat='" & IDCategoria & "' and show=yes"
    end if
    end if
    'response.write sqlcount

    Set RScounts = Conn.Execute(sqlcount)
    rcounts = RScounts(0)
    Response.Write ("( " & rcounts & " )")
    Response.Write "
    "
    Response.Write "<center><font color='#838383'>"& rs("descrizionecat")& "
    </font>"

    %>
    </font></font></TD>
    <%
    if NOT rs.EOF then
    rs.MoveNext
    end if
    ColNum = ColNum + 1
    if NOT rs.EOF then
    %>

    <TD ALIGN=LEFT VALIGN=top WIDTH="249"> [img]<%=rs([/img]"><font size="2" face="Batang">&amp;categoria=<%=server.urlencode(rs("cat"))%><%i f request.querystring("op")="filtra" then%>&amp;op=filtra&amp;id_regione=<%=request.for m("id_regione")%>&amp;id_provincia=<%=request.form ("id_provincia")%>&amp;id_comune=<%=request.form(" id_comune")%><%end if%>"><%=rs("cat")%><font face="Batang" size="3"COLOR = "#FF0000">



    <% IDCategoria= rs("id")
    if request.querystring("op")="" then
    sqlcount = "SELECT count(Titolo) FROM annunci where IDsottocat='" & IDCategoria & "' and show=yes"
    else
    if request.querystring("op")="filtra" then

    if id_regione<>"" then
    sqlcount = "SELECT count(Titolo) FROM annunci where IDsottocat='" & IDCategoria & "' and show=yes and id_regione="&id_regione&""
    end if
    if id_provincia<>"" then
    sqlcount = "SELECT count(Titolo) FROM annunci where IDsottocat='" & IDCategoria & "' and show=yes and id_provincia="&id_provincia&""
    end if
    if id_comune<>"" then
    sqlcount = "SELECT count(Titolo) FROM annunci where IDsottocat='" & IDCategoria & "' and show=yes and id_comune="&id_comune&""
    end if
    else
    sqlcount = "SELECT count(Titolo) FROM annunci where IDsottocat='" & IDCategoria & "' and show=yes"
    end if
    end if
    'response.write sqlcount
    Set RScounts = Conn.Execute(sqlcount)
    rcounts = RScounts(0)
    Response.Write ("( " & rcounts & " )")
    Response.Write "
    "
    Response.Write "<center><font color='#838383'>"& rs("descrizionecat")& "
    </font>"
    RScounts.close
    set RScounts = nothing%>
    </font></font></TD>
    <%
    END IF
    ColNum = ColNum + 1
    Loop
    %>
    <tr>
    <%
    IF NOT rs.EOF then
    rs.MoveNext
    End IF
    Loop
    %>

    </TABLE>
    </div>

  6. #6
    Moderatore di ASP e MS Server L'avatar di Roby_72
    Registrato dal
    Aug 2001
    Messaggi
    19,563
    Un bel groviglio...

    codice:
    sql = "select * from cat order by cat ASC"
    Roby

  7. #7

    oreder

    Roby, ok il codice è quello ma dove è da mettere, ti ho mandato un messaggio privato..
    E per il groviglio cosa intendi, un casino?FF0000

  8. #8
    Moderatore di ASP e MS Server L'avatar di Roby_72
    Registrato dal
    Aug 2001
    Messaggi
    19,563
    La devi sostituire a quella tua... cercala nel codice come ho fatto io...

    Roby

  9. #9

    oreder by

    potrebbe essere questa cosa dici


    <% cat = Request.QueryString("CatID")

    sql = "select * from cat order by id"
    set rs = Conn.Execute (sql)
    IF rs.EOF then
    Response.Write "<center><font color='#838383'>Non sono ancora state create Categorie !!!
    </font>"
    Else
    End IF%>

  10. #10

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.