Visualizzazione dei risultati da 1 a 9 su 9

Discussione: [sql] Limit

  1. #1

    [sql] Limit

    quale è la sintassi corretta per effettuare un LIMIT in una chiamata al database?
    il mio codice è il seguente
    Codice PHP:
                 a 0
        b 
    6
                 b
    =request.querystring("b")
        
    a=request.querystring("a")
        
        if 
    6 then
        a 
    a-6
        b 
    b-6
        
    else
        
    a+6
        b 
    b+6
        end 
    if    

        
    SQL" SELECT * FROM galleria ORDER BY ID LIMIT "&a&","&b
        set RS 
    Conn.execute(SQL)
                 
                 
    x=0
        
    do while not RS.eof
        
    if 0 then
            foto1 
    RS("Foto1")
            
    variabilebig1 RS("Foto2")
        
    end if
        if 
    1 then
            foto2 
    RS("Foto1")
            
    variabilebig2 RS("Foto2")
        
    end if
        if 
    2 then
            foto3 
    RS("Foto1")
            
    variabilebig3 RS("Foto2")
        
    end if
        if 
    3 then
            foto4 
    RS("Foto1")
            
    variabilebig4 RS("Foto2")
        
    end if
        if 
    4 then
            foto5 
    RS("Foto1")
            
    variabilebig5 RS("Foto2")
        
    end if
        if 
    5 then
            foto6 
    RS("Foto1")
            
    variabilebig6 RS("Foto2")
        
    end if
        
    x=x+1
        RS
    .MoveNext
        Loop 
    la parte iniziare mi prende i dati che passo di pagina in pagina per l'impaginazione, e poi mi dovrebbe prendere dal database i dati corretti, ma cio non accade, xche?
    Save the Cheerleader, Save the world.

  2. #2

  3. #3
    codice:
    b=request.querystring("b")
    a=request.querystring("a") 
    if len(a) = 0 or (not isNumeric(a)) then a = 0
    if len(b) = 0 or (not isNumeric(b)) then b = 6

  4. #4
    praticamente la mia è una galleria che mostra 6 foto per pagina e che clikkando su un pulsante next mi ricarica la pagina facendo visualizzare le successive foto, ora provo il codice postato, tks
    Save the Cheerleader, Save the world.

  5. #5
    non riesco a risolvere.
    io ho una pagina che visualizza le prime 6 imamgini, clikkando sulla freccia a destra mi visualizza le successive 6 mentre clikkando su quella a sinistra le precedenti 6, come faccio?
    maledetto il giorno ho iniziato con asp VVoVe:
    Save the Cheerleader, Save the world.

  6. #6
    se faccio un ciclo while
    Codice PHP:
    a=0
       b
    =5
    p
    =request.querystring("p")
    if 
    "" then p 1
    c
    =1
    do while c<
    c
    =c+1
    a
    =a+5
    b
    =b+0
    loop 
    dove p viene passata da pagina in pagina come p+1 o p-1 a seconda se deve andare alla pag succ o prec xche si blocca facendo un cliclo apparentemente infinito?...
    Save the Cheerleader, Save the world.

  7. #7
    qualcuno mi dice xche non mi prende quella p? se metto un valore fa il ciclo, ma mettendo p è come se non lo prendesse...
    Save the Cheerleader, Save the world.

  8. #8
    ho risolto mettendo questo ciclo
    Codice PHP:
     a=0
       b
    =5
    p
    =request.querystring("p")
    if 
    "" then p 1
    if 1 then
    c
    =1
    for cont=c to p
    'do while c<p
    c=c+1
    a=a+5
    b=b+0
    next
    end if 
    grazie mille a tutti btw
    Save the Cheerleader, Save the world.

  9. #9
    Moderatore di ASP e MS Server L'avatar di Roby_72
    Registrato dal
    Aug 2001
    Messaggi
    19,559
    Non ho capito perché fai questo...
    La LIMIT vuole il record di partenza e il "passo".
    Poiché ques'ultimo è fisso, il primo è sufficiente che lo passi in querystring.

    Roby

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