SitePoint Sponsor

User Tag List

Page 3 of 3 FirstFirst 123
Results 51 to 63 of 63
  1. #51
    SitePoint Wizard siteguru's Avatar
    Join Date
    Oct 2002
    Location
    Scotland
    Posts
    3,631
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by akibills View Post
    ok let me check and reply you. thanks
    Eh?

    Are you Ulthane with a different account? Or was that just a stupid fluff post to try and SPAM a (non-existent) signature?
    Ian Anderson
    www.siteguru.co.uk

  2. #52
    SitePoint Evangelist
    Join Date
    Jun 2010
    Location
    Israel
    Posts
    523
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    nope thats not me no idea what was that reply for...
    Anyways thanks for the answer i didnt want to open a new thread just for that question so i just tried to get one here.

    Have u got any idea about my 2nd question btw?

  3. #53
    SitePoint Wizard siteguru's Avatar
    Join Date
    Oct 2002
    Location
    Scotland
    Posts
    3,631
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Not sure I understand. Do you mean you have more than one photo in relation to a single pet? If yes then I'll refer you to my very early response regarding relational tables. In this sort of situation you would have a Photos table that could simply have:

    PetID | PhotoName | PhotoDesc

    ... and so you could have several different photos for a single pet. There's really not a better way to do it.

    Code:
    sSQL = "SELECT PhotoName,PhotoDesc FROM Photos WHERE PetID=" & petID
    Ian Anderson
    www.siteguru.co.uk

  4. #54
    SitePoint Evangelist
    Join Date
    Jun 2010
    Location
    Israel
    Posts
    523
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    hmm, i belive it can be solved without starting a new table in the DB, acutally, i just wanna know how can i display a few photos of the same dog in the same coluum of the table, what do i need to add to my ASP page etc? i belive i can do the rest already with the DB =)

    thats the form to display the images (atm 1 image in every coluum)
    Code:
    <%
    sSQL = "SELECT * FROM Animals WHERE (adoptionstatus= '1')  AND (animaltype= '1')  ORDER BY fileID DESC"
    Set oConn = Server.CreateObject("ADODB.Connection")
    oConn.Open "DRIVER=Microsoft Access Driver (*.mdb);DBQ=" & Server.MapPath("Database.mdb")
    Set oRS = oConn.Execute (sSQL)
    If Not oRS.EOF Then
    %>
    <table align="center" style="width: 650px;margin-bottom:10px;" border="5">
    <%
      Do While Not oRS.EOF
        sImage = oRS("FileID")
        sDesc = oRS("Desc")
    %>
      <tr>
        <td valign="middle" align="center"><a href="Database_Download.asp?FileID=<%=sImage%>"<img border="0" width="350" height="390" src="Database_Download.asp?FileID=<%=sImage%>" /></a></td><td align="right" dir="rtl"><%=sDesc%></td>
      </tr>
    <%
        oRS.MoveNext
      Loop
    %>
    </table>
    <%
    Else
      Response.Write "<p>No images to display.</p>"
    End If
    Set oRS = Nothing
    oConn.Close
    Set oConn = Nothing
    %>

  5. #55
    SitePoint Evangelist
    Join Date
    Jun 2010
    Location
    Israel
    Posts
    523
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    well i had a plan in mind, i can add to my uploading page a checkbox, if that checkbox is checked, then 4 more file uploading fields will become visible, (not all must be filled), when i submit the form, the next page which shows the images will have an IF statement, if the checkbox is checked, then adding the images to that same colluum, now i need help with doing that in the form itsself (if its even possible?)

    Thanks...

  6. #56
    SitePoint Wizard siteguru's Avatar
    Join Date
    Oct 2002
    Location
    Scotland
    Posts
    3,631
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Sorry - but if you're not willing to take on advice that will make life easier for you going forward, then there's no point in me offering any further advice.
    Ian Anderson
    www.siteguru.co.uk

  7. #57
    SitePoint Evangelist
    Join Date
    Jun 2010
    Location
    Israel
    Posts
    523
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    sorry, its not that ur advices aint good or something, im just trying things i already know to try and make it easier for me, since i still dont know how to do a few things from what u offer, like how to make the tables related to each other? and how would this solution make me able to show multiple photos of the same pet in 1 coluum? (if u can show me how the command line to display those photos looks like)

    So what i need to have are 4 tables

    1st:
    Table:
    AnimalTypes
    TypeID | AnimalType

    2nd:
    Table:
    AdoptionStatus
    AdoptID | AdoptText

    3rd:
    Table:
    Photos
    PetID | PhotoName | PhotoDesc

    4th:
    Main Table:
    Animals
    ID | TypeID | PetID | AdoptID

    Thats all right?
    Thanks for ur help...

  8. #58
    SitePoint Wizard siteguru's Avatar
    Join Date
    Oct 2002
    Location
    Scotland
    Posts
    3,631
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    That is a reasonable start to a structured relational database.

    The 3rd table does what is needed for multiple photos, provided that the PetID field is NOT set to be unique. (i.e. you can have more than one record with the same PetID value).

    To keep things simple, you can have one SQL query to get the main pet data, and as you loop through that recordset you can call another SQL query to get the photos for each PetID. In pseudo-code ...

    Code:
    sSQL1 = "SELECT * FROM Animals ORDER BY ID DESC"
    Set oRS1 = oConn.Execute sSQL1
    Do While Not oRS1.EOF
      'Some code to display the pet info
    
      'Now get the photos
      iPetID = oRS1("PetID")
      sSQL2 = "SELECT * FROM Photos WHERE PetID=" & iPetID
      Set oRS2 = oConn.Execute sSQL2
      Do While Not oRS2.EOF
        'Some code to display the photos
        oRS2.MoveNext
      Loop
      Set oRS2 = Nothing
      oRS1.MoveNext
    Loop
    Set oRS1 = Nothing
    I'm sure there may be a SQL query that could get all the info in a single recordset, but we can take one step at a time.
    Ian Anderson
    www.siteguru.co.uk

  9. #59
    SitePoint Evangelist
    Join Date
    Jun 2010
    Location
    Israel
    Posts
    523
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    ehm...this is really hard to understand i've been trying to understand how does this thing works for hours and still didn't get it...

    u say i need some code to display the pet info from the animals table, but what info excactly? if i can just get the photoDesc (which is the pet info acutally) and the pic from the Photos table...

    Also if i understand right, for example i want to display a few photos of the same dog in the same coluum, each photo will get the same description aswell, which i dont want, i want 1 description on 1 coluum for all the pictures of the same dog on the other, so perheps we need to have that desc field on a different table?

    what a mess , and thats the last thing im missing to finish with my site (at least until i get to the security part )

  10. #60
    SitePoint Evangelist
    Join Date
    Jun 2010
    Location
    Israel
    Posts
    523
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Hello pple,
    I wanted to ask something, most of the coluums on my DB are displayed as numbers (for example dogs are 1 and cats are 2)
    i think its pretty annoying displaying them all as numbers on the site itself, so my question is, how can i make the site write "dog" instead of "1" whenever it sees it for example?

    Also, i've succed making a DB that uploads the same ID for the same pictures of dogs, but how do i have them displayed in the same coluum?
    I got half of the form needed, the only thing i need help with is how to check that the current PhotoID im checking is equal to any other PhotoID on the DB.

    Thanks in advance

  11. #61
    SitePoint Zealot gidday's Avatar
    Join Date
    Jan 2007
    Posts
    191
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi ulthane

    From your earlier post it seems that if you created table 1 (animal types) as detailed then you already have the solution available.

    Sorry I didn't understand the second part of your question.
    Joe
    "All that is necessary for the triumph of evil
    is that good men do nothing."

  12. #62
    SitePoint Evangelist
    Join Date
    Jun 2010
    Location
    Israel
    Posts
    523
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Forget what i've said, this is way too complicated, errors everywhere...
    I've tried something else, first of all im using the uploading script u gave me (by Lewis Moten) to upload pics to the DB
    I haven't got any problems with uploading more than 1 photo, i've got it working, the problem is displaying those photos in the site itself, for now it displays only 1 picture from the coluum called PhotoName
    I've added 3 more coluums called PhotoName2, PhotoName3 and PhotoName4
    Now i want the page to display also the photos from those coluums aswell, what do i need to add/edit to do so?

    Code:
    <&#37;
      Do While Not oRS.EOF
        sImage = oRS("FileID")
        sDesc = oRS("Desc")
    %>
      <tr>
        <td valign="middle" align="center"><a href="Database_Download.asp?FileID=<%=sImage%>" rel="thumbnail"><img border="0" width="350" height="390" src="Database_Download.asp?FileID=<%=sImage%>"/></a></td><td align="right" dir="rtl"><%=sDesc%></td>
      </tr>
    <%
        oRS.MoveNext
      Loop
    %>
    Thanks in advance...

  13. #63
    SitePoint Evangelist
    Join Date
    Jun 2010
    Location
    Israel
    Posts
    523
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    hehe, finally after weeks of trying, i've got this thing working =) so thanks to everyone who helped with that matter


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
  •