Visualizzazione dei risultati da 1 a 7 su 7
  1. #1
    Utente di HTML.it
    Registrato dal
    May 2003
    Messaggi
    708

    Estrazione giocatori stessa categoria

    Ciao a tutti

    ho una tabella dove al suo interno inserisco i giocatori di una squadra divisi x settore giovanile, es.:

    pulcini, esordienti, giovanissimi, allievi etc...

    vorrei estrarre su 3 pagine:

    l'elenco delle categorie
    l'elenco dei giocatori appartente alla categoria cliccata in precedenza
    il dettaglio del giocatore

    ...potete aiutarmi?

    Pier

  2. #2
    elenco categorie:

    SELECT * FROM categorie

  3. #3
    Utente di HTML.it
    Registrato dal
    May 2003
    Messaggi
    708
    Ciao ti faccio vedere un pò di codice!

    Ti faccio vedere il codice della seconda pagina che dovrebbe estrarre l'elenco dei giocatori che appartengono alla stessa categoria:

    ----------------------------------------------------------------------------------------
    INIZIO CODICE
    ----------------------------------------------------------------------------------------
    <%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>


    <%
    Dim codice_categoria_v
    codice_categoria_v = request.querystring("CODICE_CATEGORIA")

    Dim rs_AnagGiocatore

    sql = "SELECT * FROM TabAnagGiocatore WHERE CODICE_CATEGORIA = '"& codice_categoria_v &"' ORDER BY COGNOME"

    Set rs_AnagGiocatore = Server.CreateObject("ADODB.Recordset")
    rs_AnagGiocatore.Open sql, cn, 3,3
    %>

    <html>
    <head></head>
    <body>
    <%
    While Not rs_AnagGiocatore.eof
    Response.write ""&rs_AnagGiocatore("COGNOME")&" - "&rs_AnagGiocatore("NOME")&" - "&rs_AnagGiocatore("CODICE_CATEGORIA")&" -
    "
    rs_AnagGiocatore.MoveNext
    Wend
    %>

    </body>
    </html>

    <%
    rs_AnagGiocatore.Close
    Set rs_AnagGiocatore = Nothing

    cn.Close
    Set cn = Nothing
    %>
    ----------------------------------------------------------------------------------------
    FINE CODICE
    ----------------------------------------------------------------------------------------

    in questa pagina non visualizzo nessun record ma non da errore!

  4. #4
    ----------------------------------------------------
    impariamo a fare un po' di debug

    *subito* dopo la composizione della stringa SQL metti

    Response.Write "maGGica SQL...: " & sql
    Response.Flush

    poi posta quello che viene a video
    ----------------------------------------------------

  5. #5
    Utente di HTML.it
    Registrato dal
    May 2003
    Messaggi
    708
    ...benissimo facciamo il debug!

    Visualizzo questo:

    maGGica SQL...: SELECT * FROM TabAnagGiocatore WHERE CODICE_CATEGORIA = '' ORDER BY COGNOME


    qui c'è il link con la pagina:

    http://pietracalcio.it/anagrafica_giocatoreA1.asp

  6. #6
    lo vedi da solo, sì, che la categoria da cercare è vuota....

  7. #7
    Utente di HTML.it
    Registrato dal
    May 2003
    Messaggi
    708
    Ciao

    ho reiniziato il "Progegetto" e voglio estrarre i dati da 3 TABELLE, ossia:

    TabSuperCategoria
    TabCategoria
    TabAnagGiocatore

    Ho creato la pagina supercategoriaA.asp nella quale estraggo tutte le SUPER CATEGORIE e dove sul campo NOME mi sono linkato alla pagina categoriaA.asp x estrarre le CATEGORIE della SUPER CATEGORIA:
    http://www.pietracalcio.it/supercategoriaA.asp
    ---------------------------------------------------------
    Il codice della pagina supercategoriaA.asp è questo:

    <%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>


    <%
    Dim rs_SuperCategoria

    sql= "SELECT * FROM TabSuperCategoria"

    Set rs_SuperCategoria = Server.CreateObject("ADODB.Recordset")
    rs_SuperCategoria.Open sql, cn, 3,3
    %>

    <html>
    <head></head>
    <body>
    <table border="1">
    <%
    While Not rs_SuperCategoria.eof

    Response.Write("<tr>")
    Response.Write("<td>")
    Response.write ""&rs_SuperCategoria("ID_SUPER_CATEGORIA")&"
    "
    Response.Write("</td>")
    Response.Write("<td>")

    Response.Write ("" & (rs_SuperCategoria.Fields.Item("NOME").Value) & "")

    Response.Write("</td>")
    Response.Write("<td>")
    Response.write ""&rs_SuperCategoria("CODICE_SUPER_CATEGORIA") &"
    "
    Response.Write("</td>")

    Response.Write("</tr>")

    rs_SuperCategoria.MoveNext
    Wend
    %>
    <td
    </table>

    </body>
    </html>

    <%
    rs_SuperCategoria.Close
    Set rs_SuperCategoria = Nothing

    cn.Close
    Set cn = Nothing
    %>
    -----------------------------------------------------

    Ora faccio fatica a capire come estrarre i valori delle CATEGORIE

    Il codice della pagina categoriaA.asp è:
    <%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>


    <%

    Dim super_categoria_v, query_str_v
    super_categoria_v = request.querystring("CODICE_SUPER_CATEGORIA")

    rs_Categoria = "SELECT NOME FROM TabCategoria WHERE CODICE_CATEGORIA = '"& super_categoria_v &"'"

    query_str_v = "SELECT NOME FROM TabCategoria WHERE CODICE_CATEGORIA = '"& super_categoria_v &"'"'Response.End()

    Set rs_Categoria = Server.CreateObject("ADODB.Recordset")
    rs_Categoria.Open query_str_v, cn, 3,3
    %>

    <html>
    <head></head>
    <body>
    <%
    While Not rs_Categoria.eof
    Response.write ""&rs_Categoria("ID_CATEGORIA")&" - "&rs_Categoria("NOME")&" - "&rs_Categoria("CODICE_CATEGORIA")&" -
    "
    rs_Categoria.MoveNext
    Wend
    %>

    </body>
    </html>

    <%
    rs_Categoria.Close
    Set rs_Categoria = Nothing

    cn.Close
    Set cn = Nothing
    %>
    ----------------------------------

    Puoi vedere dove sbaglio?

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.