Visualizzazione dei risultati da 1 a 2 su 2
  1. #1
    Utente di HTML.it L'avatar di Lino80
    Registrato dal
    Oct 2005
    Messaggi
    1,560

    problema di visualizzazione record senza .jpg nel db

    ciao..ho un problemino..non mi visualizza il record se nel db non sono presenti immagini (jpg) nel campo "nomeFoto" tabella "FotoProdotti"
    Se invece ci sono immagini caricate me lo visualizza tranquillamente..

    codice:
    <td colspan="2">
    	<%
    			iPageSize = 10 'NUMERO RECORD PER PAGINA
    
    			If Request.QueryString("page") = "" Then
    				iPageCurrent = 1
    			Else
    				iPageCurrent = CInt(Request.QueryString("page"))
    			End If
    			
                dim modello_cerca
    			modello_cerca=trim(request.QueryString("modello"))
    			
    			if len(modello_cerca)=0 then
    			strSql="select * from prodotti where id in (select idprodotto from user_prodotti where iduser=" & idUtente & ") order by id asc"
    			else
    			strSql="select * from Prodotti where lcase(modello) like '" & lcase(replace(modello_cerca,"'","''")) & "%' and id in (select idprodotto from user_prodotti where iduser=" & idUtente & ") order by id asc"
    			end if
    			
    			'response.write(strSql): response.end()
    			Set objRS = Server.CreateObject("ADODB.Recordset")
    			objRS.PageSize = iPageSize
    			objRS.CacheSize = iPageSize
    			objRS.Open strSQL, objConn, adOpenStatic, adLockReadOnly, adCmdText
    
    			reccount = objRS.recordcount
    			iPageCount = objRS.PageCount
    
    			If iPageCurrent > iPageCount Then iPageCurrent = iPageCount
    			If iPageCurrent < 1 Then iPageCurrent = 1
    
    			If iPageCount = 0 Then
    				Response.Write "
    
    
    
    Non ci sono auto inserite.</p>"
    			Else
    				objRS.AbsolutePage = iPageCurrent
    				iRecordsShown = 0
    				%>
    <%
    								'SI VISUALIZZA IL CONTENUTO DELLA STRINGA SQL
    								'ALL'INTERNO DELLA TABELLA PRIMA DEFINITA
    								cont=1
    								Do While iRecordsShown < iPageSize And Not objRS.EOF
    									Dim Rig, bg
    									Rig = Rig + 1
    									If Rig Mod 2 = 0 then
    										bg = "#E4E4E4"
    									Else
    										bg = "#ccccff"	
    									End if %>	
    									<% 
    									strSql="select top 1 * from FotoProdotti where idprodotto=" & objRS("id") & " order by id desc"  
    									'response.write(strSql): response.end()
    									set rs=conn.execute(strSql)
    									dim path_foto, rs
                                        path_foto="/public/"
                                        while not rs.eof
                                        nomeFoto = rs("nomeFoto")
    									%>
    	<table width="484" align="center" border="0" cellspacing="1" cellpadding="3">
    							<tr> 
                    <td width="77" bgcolor="#CFD0CF"><div align="center"><font color="#ffffff">Immagine</font></a></div></td>
    				<td width="110" bgcolor="#CFD0CF"><font color="#ffffff">Tipologia</font></td>
                    <td width="33" bgcolor="#CFD0CF"><font color="#ffffff">Anno</font></td>
                    <td width="22" bgcolor="#CFD0CF"><font color="#ffffff">Mq</font></td>
                    <td width="61" bgcolor="#CFD0CF"><font color="#ffffff">Incarico</font></td>
    				<td width="62" bgcolor="#CFD0CF"><font color="#ffffff">prezzo</font></td>
    				<td width="69" bgcolor="#CFD0CF"><font color="#ffffff">Opzioni</font></td>
                  </tr>
                                  <tr> 
                    <td valign="top"><img src= "<%= path_foto & rs("nomeFoto") %>" width="<%=PFoto_Larghezza%>" " border="0" div align="center" ></td>
    				<td valign="top"><%=objRS("modello")%></td>
                    <td valign="top"><%=objRS("anno")%></td>
                    <td valign="top"><%=objRS("km")%></td>
                    <td valign="top"><%=objRS("carburante")%></td>
    				<td valign="top">€ <%=objRS("prezzo")%></td>
    				<td valign="top"> 
    ">Modifica
    
    ">Cancella </p> 
                      <p align="center"> </p></tr>
            </table>
    		<%
    rs.movenext
    wend
    
    set rs=nothing
    
    %>
    <%
    								Cont = Cont + 1
    									'POSIZIONAMENTO ALLA RIGA SUCCESSIVA DEL DB
    									iRecordsShown = iRecordsShown + 1
    									objRS.MoveNext
    								Loop
    								'PULIZIA DEGLI OGGETTI ADO
    								objRS.Close
    								Set objRS = Nothing
    								%>
    								
    								<%End if%>
    			<%If ipagecount <> 1 Then%>
    	  </td>
      </tr>
      <tr>
        <td colspan="2" align="center" valign="middle"><font face="verdana" size="1" color="#000000">
    							<center>[
    							<%if iPageCurrent-2 > 0 and iPageCurrent > 2 then%>
    								Prima
    							<%end if%>
    							<%if iPageCurrent > 1 then%>
    								Precedente
    							<%end if%>
    							<%if iPageCount > 2 then
    								if iPageCurrent-2 < 1 then da_pag = 1 else da_pag = iPageCurrent-2
    								if iPageCurrent+2 > iPageCount then fino_a_pag = iPageCount else fino_a_pag = iPageCurrent+2
    							else
    								da_pag = 1
    								fino_a_pag = iPageCount
    							end if%>
    							<%for i = da_pag to fino_a_pag%>
    								<%if i = iPageCurrent then%>
    									<font color="black" size="2"><%=i%></font>
    								<%else%>	
    									<%=i%>
    								<%end if%>	
    							<%next%>
    							<%if iPageCurrent > 0 and iPageCurrent < iPageCount then%>
    								Successiva
    							<%end if%>	
    							<%if iPageCurrent+1 < iPageCount then%>
    								Ultima
    							<%end if%>	
    							]</center>
    						</font></td>
    	</tr>
    					<tr>
    						<td colspan="3" align="center"><font face="verdana" size="0.5" color="#333333">
    							<center>
    
    							Pagina
    								<font color="#000000"><%=iPageCurrent%></font>
    								di
    								<font color="#000000"><%=iPageCount%></font>
    							</center>
    							</font>
    						  
    
    <font face="verdana" size="0.5" color="#333333">
    					          <%end if%>
    	                      <%
    			objConn.Close
    			Set objConn = Nothing
    			%>
    </font></p>
    					    
    
    </p></td>

    Il codice e la query relativa alla visualizzazione della foto è questa:



    codice:
    <% 
    									strSql="select top 1 * from FotoProdotti where idprodotto=" & objRS("id") & " order by id desc"  
    									'response.write(strSql): response.end()
    									set rs=conn.execute(strSql)
    									dim path_foto, rs
                                        path_foto="/public/"
                                        while not rs.eof
                                        nomeFoto = rs("nomeFoto")
    									%>

  2. #2

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.