SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Zealot
    Join Date
    Jul 2002
    Location
    South-West UK
    Posts
    100
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Database / rs display problem

    Hi peeps.

    I'm having a few difficulties getting a table to display all the proper info once it has finished being searched etc.

    I'm having particular problems with a cell at the end of the results table which displays an image if there is an audio sample avavailable for that particular item.

    Here's the code for the table cell[VBS] <table width="100%" cellspacing="2" align="center">
    <tr bgcolor="#666666">
    <td width="52">
    <center>
    <font color="#FFFFFF"><b>Cat no.</b> </font>
    </center>
    </td>
    <td width="99">
    <center>
    <font color="#FFFFFF"><b>Artist</b> </font>
    </center>
    </td>
    <td width="96">
    <center>
    <font color="#FFFFFF"><b>A Side</b> </font>
    </center>
    </td>
    <td width="96">
    <center>
    <font color="#FFFFFF"><b>B Side </b> </font>
    </center>
    </td>
    <td width="96">
    <center>
    <font color="#FFFFFF"><b>Label</b> </font>
    </center>
    </td>
    <td width="44">
    <center>
    <font color="#FFFFFF"><b>Year</b> </font>
    </center>
    </td>
    <td width="60">
    <center>
    <font color="#FFFFFF"><b>Price (&pound</b> </font>
    </center>
    </td>
    <td width="94">
    <center>
    <font color="#FFFFFF"><b>Info</b> </font>
    </center>
    </td>
    <td width="48">&nbsp;</td>
    </tr>
    <tr bgcolor="#666666">
    <td colspan="9" bgcolor="#000000" height="1">
    <center>
    <img src="images/divider.jpg" width="740" height="1">
    </center>
    </td>
    </tr>
    <% Do While not rs.eof %>
    <tr>
    <td width="52" valign="middle"><%=rs("catno")%></td>
    <td width="99" valign="middle"><%=rs("artist")%></td>
    <td width="96" height="15" valign="middle"><%=rs("aside")%></td>
    <td width="97" valign="middle"><%=rs("bside")%></td>
    <td width="115" valign="middle"><%=rs("label")%></td>
    <td width="44" valign="middle">
    <center>
    <%=rs("year")%>
    </center>
    </td>
    <td width="60" valign="middle">
    <center>
    <%If True = rs("reserved") Then
    Response.write "<font color=yellow>Reserved</font>"

    Else
    Response.Write rs("price")
    End If
    %>
    </center>
    </td>
    <td width="94" valign="middle"><%=rs("notes")%></td>
    <td width="48" valign="middle">
    <center>
    <% If rs("sample") = "True" Then %><a href="samples/<%= rs("samplename") %>"><img src='images/small_speaker.jpg' width='18' height='15'border= '0'></a><% End If %>
    </center>
    </td>
    </tr>
    <tr valign="middle">
    <td colspan="9" height="1">
    <center>
    <img src="images/divider.jpg" width="740" height="1">
    </center>
    </td>
    </tr>
    <% rs.movenext
    loop
    %>
    </table>
    </center>
    </td>
    </tr>
    <tr>
    <td>&nbsp;</td>
    </tr>
    <tr>
    <td>&nbsp;</td>
    </tr>
    <tr>
    <td>&nbsp;</td>
    </tr>
    </table>


    <% end if 'end of check of obs for display %>[/VBS]

    The problem I'm having is for example, 10 results were found, only the first row of the table displays the image (which is in fact a link to the audio sample) and then the other rows in the table are ignoring the If Else statement and displaying nothing.

    Any ideas anyone?

    Matt

    PS.... dunno why the smiley appeared in the code

    PPS....I'm referring to the line that reads:[VBS]<% If rs("sample") = "True" Then %><a href="samples/<%= rs("samplename") %>"><img src='images/small_speaker.jpg' width='18' height='15'border= '0'></a><% End If %>
    [/VBS]
    Last edited by mattyd22; Sep 20, 2002 at 05:13.

  2. #2
    SitePoint Enthusiast
    Join Date
    Aug 2002
    Posts
    42
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    Not too sure what difference this would make but if the sample field is boolean try rs("Sample") = True without parenthesis. If the sample field is char then "True" is probably ok but True and False are recognised as reserved values which represent 0 and -1 in this context so would correspond correctly to true/false from a boolean field.

    Might help?

    Ed.

  3. #3
    SitePoint Enthusiast Utopia's Avatar
    Join Date
    Sep 2002
    Location
    United Kingdom
    Posts
    42
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Boolean values shouldnt have double quotes around them, otherwise they would be interpreted as strings.

    whats between the double quotes then becomes irrelevant because its a string, which could be anything under the sun.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •