Pagina 1 di 4 1 2 3 ... ultimoultimo
Visualizzazione dei risultati da 1 a 10 su 33
  1. #1

    stampare immagini a seconda della variabile

    ho passato una variabile in un link
    la recupero ma non riesco a far stampare le immagini a seconda della variabile

    [/CODE]

    tip_UK=request.querystring("tip_UK")

    <% if tip_UK=receiver then
    Response.write"[img]/wireless/images/top_receivers.jpg[/img]"
    else
    Response.write""
    end if
    %>
    [/CODE]

    Mi aiutate?

  2. #2
    Moderatore di ASP e MS Server L'avatar di Roby_72
    Registrato dal
    Aug 2001
    Messaggi
    19,559
    codice:
    <% if tip_UK="receiver" then
    Roby

  3. #3
    allora no passa la variabile perchè non mi stampa nulla

    codice:
    <% 
    id=request.querystring("id") 
    tip_UK=request.querystring("tip_UK") 
    
    Set objConn = Server.CreateObject("ADODB.Connection") 
    objConn.Open "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & server.MapPath("/fpdb/wire_products.mdb") 
    set rs=server.createobject("ADODB.Recordset") 
    
    strSQL = "select * from products where id = " & id
    
    rs.Open strSQL, objConn 
    if not rs.EOF then
    %>
    codice:
    <% if tip_UK="receiver" then
    Response.write"[img]/wireless/images/top_receivers.jpg[/img]"
    else
    Response.write""
    end if
    if tip_UK="transmitter" then
    Response.write"[img]/wireless/images/top_hybrids.jpg[/img]"
    else
    Response.write""
    end if
    if tip_UK="key-fob" then
    Response.write"[img]/wireless/images/top_keyfobs.jpg[/img]"
    else
    Response.write""
    end if
    if tip_UK="transceiver" then
    Response.write"[img]/wireless/images/top_transceivers.jpg[/img]"
    else
    Response.write""
    end if
    %>

  4. #4
    eh già ho fatto un response.write della SQL ma stampa solo

    select * from products where id = 121

    allora sbaglio nel passare le variabili o a recuperle? AIUTO!!!


    codice:
    <% 
    id=request.querystring("id") 
    tip_UK=request("tip_UK")
    modulation=request("modulation")
    Set objConn = Server.CreateObject("ADODB.Connection") 
    objConn.Open "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & server.MapPath("/fpdb/wire_products.mdb")
    
    strSQL=("select * from products where id='" & id &"' AND tip_UK='"& tip_UK &"' AND modulation='"& modulation &"'")
    
    set rs=server.CreateObject("ADODB.recordset")
    rs.Open strSQL, objConn
    if not rs.EOF then
    %>
    <% if tip_UK="receiver" then
    Response.write"[img]/wireless/images/top_receivers.jpg[/img]"
    else
    Response.write""
    end if
    if tip_UK="transmitter" then
    Response.write"[img]/wireless/images/top_hybrids.jpg[/img]"
    else
    Response.write""
    end if
    if tip_UK="key-fob" then
    Response.write"[img]/wireless/images/top_keyfobs.jpg[/img]"
    else
    Response.write""
    end if
    if tip_UK="transceiver" then
    Response.write"[img]/wireless/images/top_transceivers.jpg[/img]"
    else
    Response.write""
    end if
    %>

  5. #5
    Moderatore di ASP e MS Server L'avatar di Roby_72
    Registrato dal
    Aug 2001
    Messaggi
    19,559
    Se nella query le metti tutte le condizioni

    codice:
    strSQL=("select * from products where id='" & id &"' AND tip_UK='"& tip_UK &"' AND modulation='"& modulation &"'")
    le if a cosa ti servono?

    Roby

  6. #6
    perchè a seconda della variabile che viene passata dal link che arriva in questa pagina devo stampare un'immagine o un'altra!

    Come dovrei fare?

    Grazie

  7. #7
    ho scritto così ma non è corretto il response.write

    codice:
    <% 
    tip_UK=request("tip_UK") 
    'APERTURA CONNESSIONE CON IL DATABASE SENZA DSN 
    Set objConn = Server.CreateObject("ADODB.Connection") 
    objConn.Open "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & server.MapPath("/fpdb/wire_products.mdb")
    set rs=server.createobject("ADODB.Recordset") 
    strSQL = "select * from products where tip_UK = " & tip_UK
    if tip_UK="receiver" then
    response.write "RX"
    else
    response.write "no RX"
    end if
    %>

  8. #8
    Moderatore di ASP e MS Server L'avatar di Roby_72
    Registrato dal
    Aug 2001
    Messaggi
    19,559
    Io non ti capisco...
    codice:
    strSQL = "select * from products where tip_UK = '" & tip_UK &"'"
    rs.open strSQL, objConn
    if not rs.EOF then
    response.write "RX"
    else
    response.write "no RX"
    end if
    rs.Close
    set rs=nothing
    Roby

  9. #9
    perche non mi capisci...cosa ho detto di confuso

    a seconda del valore dei "tip_UK" devo fare un response.write di una immagine diverso, come faccio?

    Come mi hai scritto tu non prevede altre condizioni io ne ho ben 5 di valori diversi per questo campo (tip_UK)

    tip_UK="receiver"
    tip_UK="transmitters"
    tip_UK="key-fob"
    tip_UK="transceiver"
    tip_UK="special"

    codice:
          <% 
    tip_UK=request.querystring("tip_UK") 
    'APERTURA CONNESSIONE CON IL DATABASE SENZA DSN 
    Set objConn = Server.CreateObject("ADODB.Connection") 
    objConn.Open "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & server.MapPath("/fpdb/wire_products.mdb")
    set rs=server.createobject("ADODB.Recordset") 
    strSQL = "select * from products where tip_UK = '" & tip_UK &"'"
    rs.open strSQL, objConn
    if not rs.EOF then
    response.write "RX"
    else
    response.write "no RX"
    end if
    rs.Close
    set rs=nothing
    %>
    Scusa la testa di coccio!

  10. #10
    Moderatore di ASP e MS Server L'avatar di Roby_72
    Registrato dal
    Aug 2001
    Messaggi
    19,559
    Posso anche essere d'accordo ma allora nella SELECT cosa ce la metti a fare la condizione se non ti serve???

    codice:
    strSQL = "select * from products where tip_UK = '" & tip_UK &"' "
    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 © 2025 vBulletin Solutions, Inc. All rights reserved.