Re: multiple row updates in MYSQL using HTML

From: Gary (reachus_at_netlink.info)
Date: 01/16/04

  • Next message: dna: "DBI SQL column datatype not jiving with SQL statement requirement"
    Date: Fri, 16 Jan 2004 14:26:11 -0500
    
    

    "Erik Tank" <erik@jundy.com> wrote in message
    news:08b1359e7e64dd0a2c57fbf7f0a93ac6@news.teranews.com...
    > Sound like you have right approach.
    >
    > Since I don't know the structure of your table I will just assume that
    > each record has a unique ID field. I would use this field instead of
    > a simple counter value.
    >
    > The only other thing that I can think of is to add a checkbox next to
    > each row and then you can only update the records that are check. You
    > may also want to add a second button that updates each row no matter
    > if the checkbox is checked incase you are updating most of the records
    > and hitting the check box becomes a pain.
    >
    >
    > On Thu, 15 Jan 2004 19:52:33 -0500, "Gary" <reachus@netlink.info>
    > wrote:
    >
    > >I haver a table of students - Say 100 students that I need to be able to
    > >update/delete and amend. I know I can do this one student at a time which
    is
    > >simple but lets say I want to see all the students on the screen at the
    same
    > >time, modify some, mark some for deletion and even have blank fields at
    the
    > >end to add a new record.
    > >
    > >In HTML which is generated I label each row and input field with a
    > >name/number combination i.e <input type=text value=mysqlvalue
    > >name=field$cnt> where the number ($cnt) is incremented each row and then
    I
    > >pass these fields (all of them) to another routine to actually do the
    > >update.
    > >
    > >With 100 Students displayed I need about 500 variables minimum so I can
    > >store all new values entered on any of the 100 students and then pass
    them
    > >all to another perl script to perform the update.
    > >
    > >There must be a better way - Any pointers or examples anywhere would be
    > >excellent.
    > >
    > >I basically need maintenance of one table with unlimited rows containing
    say
    > >5 fields using Perl/HTML and MySQL.
    > >
    > >Many thanks
    > >Gary
    > >
    >

    That is scary.

    Asuume I want to have an unlimited number of rows maintained by the user,
    say 200 rows. If there are 5 fields in the row then I would need to declare
    1000 fields just to update the table unless I use some changedrecord type
    field the user can tick. This is ugly ! Is this really the only way ?

    Even with a check box I would still need to pass all of the records anyway
    just to see which they wanted to actually update. Currently I hold the
    previous key value of the row and pass that to the next cgi so I can update
    using WHERE key-field=previous-value, but again it is messy !

    Do you know any examples of a multipe row update using MySQL and Perl and
    HTML ?

    Gary


  • Next message: dna: "DBI SQL column datatype not jiving with SQL statement requirement"