Professional Web Applications Themes

Updating Multiple Records - Macromedia Dreamweaver

I have a table in a database that contains all my photos. The fields are like Name, SRC, GalleryName, DateAdded, SpecialStyle. The only one you may be confused about is Special Style. I include that field in my databases so I can overrid some CSS settings for particular items. To display a listing of the galleries (to then go on and select a specific picture) I had a query that just finds all the distinct gallery names from the Photo table. I have also set that query to group by SpecialStyle so that listing will show up as red for ...

  1. #1

    Default Updating Multiple Records

    I have a table in a database that contains all my photos. The fields are
    like Name, SRC, GalleryName, DateAdded, SpecialStyle. The only one you may
    be confused about is Special Style. I include that field in my databases so
    I can overrid some CSS settings for particular items.

    To display a listing of the galleries (to then go on and select a specific
    picture) I had a query that just finds all the distinct gallery names from
    the Photo table. I have also set that query to group by SpecialStyle so that
    listing will show up as red for example. Is it possible, through the query,
    or some other access technique to get color: red into the query called
    GalleryListings, or to update all the photos with that particular gallery
    with that in their specialstyle item so it then groups by that in the query?

    Jrodan


    Jordan Marton Guest

  2. #2

    Default Re: Updating Multiple Records

    EXAMPLE:

    [url]http://www.tufts2006.com/photo_album.asp[/url]

    You'll see in the dropdown for Molsen night that it lists two items for the
    same. One red and one yellow. This is because only one of the pictures from
    the photo table has the red as its special color, thus the query groups by
    that one, and then the blank ones. Of course, I could solve this by setting
    the color for all of them as red and it would group into one, but thats too
    hard to do!

    Jordan

    "Jordan Marton" <JMartonHAHAmarketaxess.com> wrote in message
    news:beh3t8$8tc$1forums.macromedia.com...
    > I have a table in a database that contains all my photos. The fields are
    > like Name, SRC, GalleryName, DateAdded, SpecialStyle. The only one you may
    > be confused about is Special Style. I include that field in my databases
    so
    > I can overrid some CSS settings for particular items.
    >
    > To display a listing of the galleries (to then go on and select a specific
    > picture) I had a query that just finds all the distinct gallery names from
    > the Photo table. I have also set that query to group by SpecialStyle so
    that
    > listing will show up as red for example. Is it possible, through the
    query,
    > or some other access technique to get color: red into the query called
    > GalleryListings, or to update all the photos with that particular gallery
    > with that in their specialstyle item so it then groups by that in the
    query?
    >
    > Jrodan
    >
    >

    Jordan Marton Guest

  3. #3

    Default Re: Updating Multiple Records

    > You'll see in the dropdown for Molsen night that it lists two items for
    the
    > same. One red and one yellow. This is because only one of the pictures
    from
    > the photo table has the red as its special color, thus the query groups by
    > that one, and then the blank ones. Of course, I could solve this by
    setting
    > the color for all of them as red and it would group into one, but thats
    too
    > hard to do!
    You want to update the table's SpecialStyle column to a certain style for
    the specific gallery?
    For example, Molsen is the name of a photo album, and it has 2 photos in
    it...so thats 2 records..

    Name | GalleryName | SpecialStyle
    User1 | Molsen | Red
    User1 | Molsen | Yellow

    Thats as it is now, and you want to update the SpecialStyle for all
    galleries to one certain color?

    --
    Ron


    Ron Guest

  4. #4

    Default Re: Updating Multiple Records

    Well the way it is now...

    Name Gallery SRC Stlye
    Photo1 Hawaii photo1.jpg color: red
    photo2 Hawaii gifs/photo2.gif color: red
    ....

    And then my query would list all of the galleries it finds.

    GalleryName NumPhotos Style
    .... ... ...
    Hawaii 2 color:red
    .... ... ...

    So if all the photos in a particular gallery have the same style, then it is
    represented in the query. But if one photo has the color and rest do not, I
    get this as my query for gallery names:

    .... ... ...
    Hawaii 1 color:red
    Hawaii 1
    .... ... ...

    Because technically it is grouping by the style as well. So what I'm looking
    for is a way to quickly update ALL the photos for a specific gallery so I
    don't end up with my second scenario by accident.

    Jordan


    "Ron" <ron0079spamaol.com> wrote in message
    news:beiin0$pvo$1forums.macromedia.com...
    > > You'll see in the dropdown for Molsen night that it lists two items for
    > the
    > > same. One red and one yellow. This is because only one of the pictures
    > from
    > > the photo table has the red as its special color, thus the query groups
    by
    > > that one, and then the blank ones. Of course, I could solve this by
    > setting
    > > the color for all of them as red and it would group into one, but thats
    > too
    > > hard to do!
    >
    > You want to update the table's SpecialStyle column to a certain style for
    > the specific gallery?
    > For example, Molsen is the name of a photo album, and it has 2 photos in
    > it...so thats 2 records..
    >
    > Name | GalleryName | SpecialStyle
    > User1 | Molsen | Red
    > User1 | Molsen | Yellow
    >
    > Thats as it is now, and you want to update the SpecialStyle for all
    > galleries to one certain color?
    >
    > --
    > Ron
    >
    >

    Jordan Marton Guest

  5. #5

    Default Re: Updating Multiple Records

    I see what your getting at...don't have an answer yet, but consider this
    database layout:

    TableName: Galleries
    GalleryID (primary key)
    OwnerID (user id, foreign key)
    GalleryName
    Style

    TableName: GalleryImages
    ImageID (primary key)
    GalleryID (Galleries.GalleryID, foreign key)
    ImagePath

    With that, you can imagine this scenario:
    User registers, goes to Create Gallery
    User enters Gallery information (gallery name, selects style)
    User goes to Upload Images
    Images submitted to GalleryImages with the newly created GalleryID

    User goes to Admin My Galleries
    User selects a Gallery from a list of his/her galleries
    Images are shown for that gallery allowing to update/delete

    If it ain't too late to rethink the database layout, consider that one.

    As it is now, that table has redundant data...meaning there are many records
    with the same gallery name and same style in the table. The practice of
    "normalization" is meant to prevent that. Sometimes its not possible, or
    feasible to prevent redundant data, but I think in this case it is the
    correct choice. The alternative layout suggested above uses "foreign-key
    mapping" to associate the Gallery to the GalleryImage(s).

    As for the existing problem, the only thing I can think of is to use the
    query builder to run an update query on each record for a specific gallery,
    updating the Style to the chosen color. The query would look like this in
    Access SQL View:

    UPDATE Galleries SET Style=["Enter Style"] WHERE GalleryName = ["Enter
    name"]

    When you click the run button, you'll have to enter the desired style
    ("red"), then the gallery name ("Hawaii"), and it will update the rows
    appropriately for that gallery. You'll have to do that for each GalleryName.

    If you want to try the alternative layout, then you'll need to figure a way
    to import the existing data to the new tables...have to try out the various
    Query types in Access to do that.

    --
    Ron


    Ron Guest

  6. #6

    Default Re: Updating Multiple Records

    Thanks for your suggestion!!!

    I think that I was thinking of something like that a few weeks after I made
    the first version of my site, but had decided it would be too difficult to
    change everything at that point. HOWEVER, now that I am re-designing and
    re-building the site from scratch, I suppose I could put a little extra
    effort in and re-design that part of the database. It wouldn't be too
    difficult, I'll just export stuff out into excel, and then copy it all back
    in to a better table layout.

    THANKS!

    Jordan

    "Ron" <ron0079spamaol.com> wrote in message
    news:bej7rt$n85$1forums.macromedia.com...
    > I see what your getting at...don't have an answer yet, but consider this
    > database layout:
    >
    > TableName: Galleries
    > GalleryID (primary key)
    > OwnerID (user id, foreign key)
    > GalleryName
    > Style
    >
    > TableName: GalleryImages
    > ImageID (primary key)
    > GalleryID (Galleries.GalleryID, foreign key)
    > ImagePath
    >
    > With that, you can imagine this scenario:
    > User registers, goes to Create Gallery
    > User enters Gallery information (gallery name, selects style)
    > User goes to Upload Images
    > Images submitted to GalleryImages with the newly created GalleryID
    >
    > User goes to Admin My Galleries
    > User selects a Gallery from a list of his/her galleries
    > Images are shown for that gallery allowing to update/delete
    >
    > If it ain't too late to rethink the database layout, consider that one.
    >
    > As it is now, that table has redundant data...meaning there are many
    records
    > with the same gallery name and same style in the table. The practice of
    > "normalization" is meant to prevent that. Sometimes its not possible, or
    > feasible to prevent redundant data, but I think in this case it is the
    > correct choice. The alternative layout suggested above uses "foreign-key
    > mapping" to associate the Gallery to the GalleryImage(s).
    >
    > As for the existing problem, the only thing I can think of is to use the
    > query builder to run an update query on each record for a specific
    gallery,
    > updating the Style to the chosen color. The query would look like this in
    > Access SQL View:
    >
    > UPDATE Galleries SET Style=["Enter Style"] WHERE GalleryName = ["Enter
    > name"]
    >
    > When you click the run button, you'll have to enter the desired style
    > ("red"), then the gallery name ("Hawaii"), and it will update the rows
    > appropriately for that gallery. You'll have to do that for each
    GalleryName.
    >
    > If you want to try the alternative layout, then you'll need to figure a
    way
    > to import the existing data to the new tables...have to try out the
    various
    > Query types in Access to do that.
    >
    > --
    > Ron
    >
    >

    Jordan Marton Guest

Similar Threads

  1. Updating multiple records in a linked table simultaneously
    By Aaron Roberson in forum Coldfusion Database Access
    Replies: 2
    Last Post: January 25th, 06:41 PM
  2. Updating Multi records
    By rddave51 in forum Dreamweaver AppDev
    Replies: 1
    Last Post: April 10th, 04:37 PM
  3. Updating Multiple records fields in a database atonce
    By kris f in forum Coldfusion - Advanced Techniques
    Replies: 0
    Last Post: February 17th, 03:36 AM
  4. updating multiple records on one page
    By BP Prgm in forum ASP Database
    Replies: 1
    Last Post: September 17th, 02:52 AM
  5. updating multiple records via online form
    By dukeofwhelmsley in forum ASP
    Replies: 2
    Last Post: September 8th, 07:36 PM

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
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139