Visualizzazione dei risultati da 1 a 10 su 10
  1. #1

    problema inner join consiglio

    ciao a tutti.. son sempre qua..
    devo collegare 2 tabelle la prima tabella servizi_hotel mi estrai i numeri questi numeri devono essere trasformati in parole in base alla tabella lista_servizi ..

    Codice PHP:
    sql_gen="select distinct hotelfacilitytype_id from servizi_hotel where servizi_hotel.facilitytype_id=3 and servizi_hotel.value=1 and servizi_hotel.hotel_id="&hotel_id&" INNER JOIN lista_servizi ON lista_servizi.languagecode='it' and lista_servizi.name AS hotelfacilitytype_id" 
    mi sono incasinato però .. c'è qualche errore.. operatore mancante..
    Immagini allegate Immagini allegate
    • Tipo di file: gif 1.gif‎ (22.7 KB, 46 visualizzazioni)

  2. #2
    slay_slay_slay, oramai sai come si fa il debug. fatti stampare la stringa e controllala

  3. #3
    non riesco a fare la stampa mi questo errore...

    i campi sono tutti numerici tranne lista_servizi.languagecode

    Errore di sintassi (operatore mancante) nell'espressione della query 'servizi_hotel.facilitytype_id=3 and servizi_hotel.value=1 and servizi_hotel.hotel_id=92375 INNER JOIN lista_servizi ON lista_servizi.languagecode='it' and lista_servizi.name AS hotelfacilitytype_id'.

  4. #4
    Originariamente inviato da slay
    non riesco a fare la stampa
    maro'.....


    ----------------------------------------------------
    *subito* dopo la composizione della stringa SQL metti

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

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

  5. #5
    ehh.. scusa dai... ho un sacco di if e sessioni di lingua avevo messo la stampa dopo apertura rs cmq..

    select distinct hotelfacilitytype_id from servizi_hotel where servizi_hotel.facilitytype_id=3 and servizi_hotel.value=1 and servizi_hotel.hotel_id=92375 INNER JOIN lista_servizi ON lista_servizi.languagecode='it' and lista_servizi.name AS hotelfacilitytype_id
    Microsoft JET Database Engine error '80040e14'

    Errore di sintassi (operatore mancante) nell'espressione della query 'servizi_hotel.facilitytype_id=3 and servizi_hotel.value=1 and servizi_hotel.hotel_id=92375 INNER JOIN lista_servizi ON lista_servizi.languagecode='it' and lista_servizi.name AS hotelfacilitytype_id'.

    /hotel_spagna2.asp, line 949

  6. #6
    forse l'ultima AS va sostituita con =

  7. #7
    non funge .. cmq secondo te il ragionamento che ho fatto è giusto?

  8. #8

  9. #9
    a uno che mi dice 'non funge' e mi chiede 'che sbaglio?' rispondo 'qualcosa'

  10. #10

    ho fatto così: il tutto funziona però volevo rendere il codice un po' più snello usando appunto le join

    Codice PHP:
    <%dim rs_gen,sql_gen
    Set rs_gen 
    Server.CreateObject("ADODB.Recordset")
    sql_gen="select distinct hotelfacilitytype_id from servizi_hotel where facilitytype_id=3 and value=1 and hotel_id="&hotel_id&" "
    rs_gen.open sql_gendcnDB33

    if not rs_gen.eof then
    do until rs_gen.eof%>
                
    <% 
    dim servizio_id
    servizio_id 
    rs_gen("hotelfacilitytype_id")%>
                                 
      <%
    dim rs_gens,sql_gens
      Set rs_gens 
    Server.CreateObject("ADODB.Recordset")    
      
    sql_gens="select * from lista_servizi where languagecode ='it' and hotelfacilitytype_id="&servizio_id&" "
      
    rs_gens.open sql_gensdcnDB33
      
    do until rs_gens.eof%>
                                         
    <%=
    rs_gens("name")%>,
                                        
    <% 
    rs_gens.movenext 
    loop 
    %>
    <%
    rs_gens.close 
    set rs_gens
    =nothing%>
                                 
                                
    <% 
    rs_gen.movenext 
    loop 
    else%>
    Nessun servizio trovato guarda i servizi per le camere durante la prenotazione!
    <%
    end if
    rs_gen.close 
    set rs_gen
    =nothing%> 

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.