View Single Post
  #1 (permalink)  
Old July 14th, 2015, 09:11 AM
hudsonalves hudsonalves is offline
Authorized User
Points: 42, Level: 1
Points: 42, Level: 1 Points: 42, Level: 1 Points: 42, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jul 2015
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Question Help with logic to photo album

Hi,

I have a BD with two tables:

- The first call TYPES register where the album name, it have the following columns: type_id and TYPE_NAME.
- The second call PICTURES register where the photos in the album, it got the following columns: PIC_ID, PIC_TYPE (where type_id use the data to relate), PIC_NAME and PIC_IMAGE.

Well, when I call the code on html it is acting in a different way. Example: If I register the album named "ASP" and enter three photos in this album, by calling the following code behind it 3 album named "ASP" and a picture in each of them. The correct would bring a name called "ASP" and three pictures registered in it.


Code:
<%
Dim rsTypesGallery__MMColParam
rsTypesGallery__MMColParam = "1"
If (Request.QueryString("iUsuario") <> "") Then 
  rsTypesGallery__MMColParam = Request.QueryString("iUsuario")
End If
%>

<%
Dim rsTypesGallery
Dim rsTypesGallery_numRows
Set rsTypesGallery = Server.CreateObject("ADODB.Recordset")
rsTypesGallery.ActiveConnection = MM_conn_STRING
rsTypesGallery.Source = "SELECT TOP 20 * FROM TYPES, PICTURES WHERE TYPE_USER = '" + Replace(rsTypesGallery__MMColParam, "'", "''") + "' AND TYPE_ID = PIC_TYPE ORDER BY TYPE_DATED DESC"
rsTypesGallery.CursorType = 0
rsTypesGallery.CursorLocation = 2
rsTypesGallery.LockType = 1
rsTypesGallery.Open()
rsTypesGallery_numRows = 0
%>
	
<main role="main">
 <section>
  <div class="section-inner " style="background-color: #9899a8; ">
   <div class="container portfolio" data-id="44">
    <div class="portfolio-list">
     <ul class="row clear">
      <%
      Do while not rsTypesGallery.eof
      %>
      <li class="col col-3 mobile-full lightbox">
      <a href="typeimage.asp?iType=<%=(rsTypesGallery.Fields.Item("TYPE_ID").Value)%>">
       <img width="480" height="360" src="../images/<%= rsTypesGallery.Fields.Item("TYPE_IMAGE") %>" />
       <span class="icon retroicon-gallery"></span>
        <h3><%=(rsTypesGallery.Fields.Item("TYPE_NAME").Value)%></h3>
      </a>
      
      <span class="hidden-gallery hidden">
       <a class="mfp-image" href="../images/<%= rsTypesGallery.Fields.Item("PIC_IMAGE") %>"></a>
      </span>
      </li>	
      
      <%
	rsTypesGallery.movenext
	loop
      %>
     </ul>
    </div><!-- portfolio-list -->
   </div>
  </div>
 </section>	
</main>
<%
rsTypesGallery.close
%>
Please help me, I think the mistake that this excerpt:

Code:
rsTypesGallery.Source = "SELECT TOP 20 * FROM TYPES, PICTURES WHERE TYPE_USER = '" + Replace(rsTypesGallery__MMColParam, "'", "''") + "' AND TYPE_ID = PIC_TYPE ORDER BY TYPE_DATED DESC"