Pagina 5 di 5 primaprima ... 3 4 5
Visualizzazione dei risultati da 41 a 49 su 49
  1. #41
    fatti stampare STRSQL e controllala (oppure postala che la si controlla assieme)

  2. #42
    Utente di HTML.it
    Registrato dal
    Jul 2005
    Messaggi
    2,614
    Tutto ok, era un mio errore avevo lasciato al where il nome della colonna.
    Se volessi modificare la paginazione in modo che si vedessero i numeri delle pagine passate?
    Lo script così comè quando passo alla seconda pagina mi fa vedere: indietro 2 - 3 - 4 avanti
    Invece come posso modificarlo in modo che mi facesse vedere il numero delle pagine passate esempio:
    indietro 1 - 2 - 3 avanti anche mi se mi trovo alla 2 o terza pagina
    codice:
    <%
    
    page = page
    totPage = pagine_totali
    Max = 9
    
    startPage = page
    EndPage = page + Max
    
    if page > 1 then
    Response.write("<a href=""search.asp?page="& page -1 &""">Indietro</a>&nbsp;&nbsp;&nbsp;")
    end if
    
    if EndPage > totPage then EndPage = totPage
    
    for i = StartPage to EndPage
    If i = totPage then
    Response.Write("")
    Else
    If i = page then
    Response.Write("<b>" & i & "</b>")
    else
    Response.write ("<a href=""search.asp?page=" & i & """> " & i & " </a> ")
    end if
    end if
    next
    
    if page < totpage then
    Response.write ("&nbsp;&nbsp;&nbsp;<a href=""search.asp?page=" & page +1 & """>Avanti</a> ")
    end if
    %>
    Grazie 1000

  3. #43
    direi che si tratta di tutt'altro problema: che ne dici di aprire un altro thread?

    sarebbe anche bello che tu postassi la soluzione, per capire come l'hai effettivamente implementata

  4. #44
    Utente di HTML.it
    Registrato dal
    Jul 2005
    Messaggi
    2,614
    Giusto eccola:
    codice:
    ricerca = request.querystring("keywords")
    sek=split(ricerca," ")
    myWHERE = ""
    for i=0 to ubound(sek)
      if len(sek(i))>2 then
          if i>0 then
                   myWHERE = myWHERE + " OR "
                   end if
          myWHERE = myWHERE & " MYCOLUMN LIKE '%" & sek(i) & "%' "
      end if
    next
      
    myQuery1=replace(myWHERE, "MYCOLUMN", "DESCRIZIONE")
    myQuery2=replace(myWHERE, "MYCOLUMN", "PIANO_OPERA")
    
    strSQL = "SELECT * FROM ("
    strSQL = strSQL & "SELECT *"
    strSQL = strSQL & "FROM miatab WHERE "&myQuery1&" "
    strSQL = strSQL & "UNION "
    strSQL = strSQL & "SELECT *"
    strSQL = strSQL & "FROM miatab WHERE "&myQuery2&" "
    strSQL = strSQL & ") "
    Set objRS = objConn.Execute(strSQL)

  5. #45
    tutto sto casino per due colonne? avevi detto che ne avevi mille mila... (al netto che può sempre servire)

  6. #46
    Utente di HTML.it
    Registrato dal
    Jul 2005
    Messaggi
    2,614
    è ridotto volutamente ma effettivamente ne avevo na cinquatina di colonne per tabella

  7. #47
    ooookkkey!

    allora se vuoi risparmiare un po' di variabili puoi fare così

    '... togli myQuery1=... myQuery2=...

    strSQL
    ="SELECT * FROM ("
    strSQL
    = strSQL &"SELECT * "
    strSQL
    = strSQL &"FROM miatab WHERE " & replace(myWHERE,"MYCOLUMN","DESCRIZIONE") & " "
    strSQL = strSQL &"UNION "
    strSQL
    = strSQL &"SELECT * "
    strSQL
    = strSQL &"FROM miatab WHERE " & replace(myWHERE,"MYCOLUMN","PIANO_OPERA") & " "
    strSQL = strSQL &") "
    Set objRS = objConn.Execute(strSQL)

    --------------

    inoltre non vedo l'implementazione della SELECT col nome di colonna, hai messo una SELECT *

    hai semplificato un po' troppo e non si vede una parte importante dell'implementazione!

  8. #48
    Utente di HTML.it
    Registrato dal
    Jul 2005
    Messaggi
    2,614
    hai ragione.... ho fatto un copia-incolla errato ecco completo del tuo ultimo suggerimento!!

    codice:
    ricerca = request.querystring("keywords")
    sek=split(ricerca," ")
    myWHERE = ""
    for i=0 to ubound(sek)
      if len(sek(i))>2 then
          if i>0 then
                   myWHERE = myWHERE + " OR "
                   end if
          myWHERE = myWHERE & " MYCOLUMN LIKE '%" & sek(i) & "%' "
      end if
    next
      
    strSQL = "SELECT * FROM ("
    strSQL = strSQL & "SELECT 'miatab' AS nome_db, 'MIACOLONNA1' AS nome_colonna, id AS id_riga, MIACOLONNA1 AS Valore "
    strSQL = strSQL & "FROM miatab WHERE "&replace(myWHERE, "MYCOLUMN", "DESCRIZIONE")&" "
    strSQL = strSQL & "UNION "
    strSQL = strSQL & "SELECT 'miatab' AS nome_db, 'MIACOLONNA2' AS nome_colonna, id AS id_riga, MIACOLONNA2 AS Valore "
    strSQL = strSQL & "FROM miatab WHERE "&replace(myWHERE, "MYCOLUMN", "PIANO_OPERA")&" "
    strSQL = strSQL & ") "
    Set objRS = objConn.Execute(strSQL)

  9. #49
    Utente di HTML.it
    Registrato dal
    Jul 2005
    Messaggi
    2,614
    Scusate se riapro questo post, ma ho riscontrato un errore non testato per dimenticanza, lo script dovrebbe escludere le ricerca al di sotto di 2 caratteri, mentre che succede, la ricerca la fa dai 2 caratteri a scendere ma va in errore db

    Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
    [MySQL][ODBC 3.51 Driver][mysqld-5.5.59-38.11-log]You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near
    etc..

  10. #50
    la risposta è la solita da 12.758 anni: fatti stampare strSQL e postala

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 © 2024 vBulletin Solutions, Inc. All rights reserved.