Editing an mySQL database without a primary key?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • - Jesus Christ -
    Confirmed User
    • Mar 2003
    • 7197

    #1

    Editing an mySQL database without a primary key?

    How can I easily change the one of values in a table wihout a primary key?

    *nix running MySQL 3.23.58

    Amen
  • toddler
    Confirmed User
    • Jun 2002
    • 1911

    #2
    you need to be very verbose in your update such that you have enough where clauses to make a discreet data set. Make sense?
    http://www.flickr.com/photos/zoddler/

    Comment

    • Carrie
      Confirmed User
      • Apr 2002
      • 3162

      #3
      For one row or all rows?
      If for all rows, are the values you want to change currently all the same or are they all something different?

      Comment

      • - Jesus Christ -
        Confirmed User
        • Mar 2003
        • 7197

        #4
        Originally posted by toddler
        you need to be very verbose in your update such that you have enough where clauses to make a discreet data set. Make sense?
        No....



        dir listings have pretty colors.

        Originally posted by Carrie
        For one row or all rows?
        If for all rows, are the values you want to change currently all the same or are they all something different?
        I only want to change the contents of one row... the wors are all different. Each row only has one value.

        Amen

        Comment

        • Babaganoosh
          ♥♥♥ Likes Hugs ♥♥♥
          • Nov 2001
          • 15841

          #5
          why would the primary key matter?

          UPDATE TABLE SET column='value' WHERE column='value'
          I like pie.

          Comment

          • - Jesus Christ -
            Confirmed User
            • Mar 2003
            • 7197

            #6
            Originally posted by Armed & Hammered
            why would the primary key matter?

            UPDATE TABLE SET column='value' WHERE column='value'
            Yea I'll just launched putty to try command line.... Webmin is Giving me this BS about a primary key.

            Amen

            Comment

            • xxxoutsourcing
              Confirmed User
              • Oct 2003
              • 3888

              #7
              It's real easy to do in PHPMYSQL.

              xxxoutsourcing.com
              ICQ:119936 | Aim:xxxoutsourcing | MSN:msn@ xxxoutsourcing.com | Yahoo:xxxoutsourcing
              Submitters, Designers, Programmers, Cartoonist, Creative Writers, Video & Photo Editors
              Convert your Paysite into a cartoon site convert2toons.com

              Comment

              • Carrie
                Confirmed User
                • Apr 2002
                • 3162

                #8
                Originally posted by Armed & Hammered
                why would the primary key matter?

                UPDATE TABLE SET column='value' WHERE column='value'
                If any of the other rows happen to have the same value, it'll change them too with this statement.

                JC if you're not coding something and you just want to fiddle with a table, try downloading PHPMyAdmin.
                It's free and it's really easy to use. Google for it.
                It will lay out the database like a spreadsheet so it's easy to look at, and you can directly edit the values for whichever row you want (just click the 'edit' link at the end of that particular row).

                Comment

                • JSA Matt
                  So Fucking Banned
                  • Aug 2003
                  • 5464

                  #9
                  Originally posted by Carrie

                  If any of the other rows happen to have the same value, it'll change them too with this statement.
                  Match it up better...

                  UPDATE table SET this_col='' WHERE col_one='' AND col_two='';

                  ps: http://www.phpmyadmin.net/

                  Comment

                  • - Jesus Christ -
                    Confirmed User
                    • Mar 2003
                    • 7197

                    #10
                    I've alread ytryed phpmyadmin. It just gives an SQL error whe nI try to edit the contents. Im trying to "hack" (basically append) somthing to a scripts copyrite message. I guess its somehow protected after the databse is initally created.

                    Amen

                    Comment

                    • Babaganoosh
                      ♥♥♥ Likes Hugs ♥♥♥
                      • Nov 2001
                      • 15841

                      #11
                      Originally posted by Carrie

                      If any of the other rows happen to have the same value, it'll change them too with this statement.

                      JC if you're not coding something and you just want to fiddle with a table, try downloading PHPMyAdmin.
                      It's free and it's really easy to use. Google for it.
                      It will lay out the database like a spreadsheet so it's easy to look at, and you can directly edit the values for whichever row you want (just click the 'edit' link at the end of that particular row).
                      Obviously. That's just an example. He's smart enough to narrow it down if he needs to.
                      I like pie.

                      Comment

                      • BlueDesignStudios
                        Confirmed User
                        • Feb 2003
                        • 9492

                        #12
                        get out of SQL, in unix type in: rm -r

                        & and that should do the trick


                        Blue Design Studios - Adult Design Specialists!
                        Email me for a free quote: [email protected]

                        Comment

                        • Carrie
                          Confirmed User
                          • Apr 2002
                          • 3162

                          #13
                          Nah, it's not protected. You're probably just using the wrong box to do what you're trying to do or you've got magic quotes turned on or something so that PHPMyAdmin has a problem interpreting things.

                          Don't use the big SQL box where you can type commands. Instead, Browse the table, go to the row you want to change, and hit the 'Edit' link. When you 'append' your information, don't use apostrophes or quote marks.

                          Alternatively, just look in the code itself and where it calls the value for the copyright message, add your HTML afterwards. (Once the PHP code is done and it goes back into normal html.)

                          Dang this is hard to explain to a non-coder.

                          Comment

                          • - Jesus Christ -
                            Confirmed User
                            • Mar 2003
                            • 7197

                            #14
                            Originally posted by BlueDesignStudios
                            get out of SQL, in unix type in: rm -r

                            & and that should do the trick

                            ITs going through a list of stuff really fast....

                            ??

                            Whats it doing?

                            Amen

                            Comment

                            • dotwind
                              Confirmed User
                              • Dec 2003
                              • 285

                              #15
                              the problem you probably have is that if 2 rows have the same value it would give you an error since it needs a unique identifier to update/delete. had run in that problem myself couple of times using MS SQL when i am editing the data using the GUI.. i don't know if it's the same with MySql but when I just lauch the query from a script it goes trough. a good way to find a solution is to google the error you get or post it here it might help.
                              Custom large/complex systems programing.<br>ASP.Net, C#, XML, MS SQL, WebServices(SOAP).<br>ICQ: 235719545

                              Comment

                              • Carrie
                                Confirmed User
                                • Apr 2002
                                • 3162

                                #16
                                Originally posted by BlueDesignStudios
                                get out of SQL, in unix type in: rm -r

                                & and that should do the trick

                                Feeling like having a death wish tonight when he wipes his server?

                                Comment

                                • dotwind
                                  Confirmed User
                                  • Dec 2003
                                  • 285

                                  #17
                                  Originally posted by - Jesus Christ -
                                  ITs going through a list of stuff really fast....

                                  ??

                                  Whats it doing?
                                  don't worry it's just looking for what you wanted to do and would do it right now
                                  Custom large/complex systems programing.<br>ASP.Net, C#, XML, MS SQL, WebServices(SOAP).<br>ICQ: 235719545

                                  Comment

                                  • Babaganoosh
                                    ♥♥♥ Likes Hugs ♥♥♥
                                    • Nov 2001
                                    • 15841

                                    #18
                                    Originally posted by BlueDesignStudios
                                    get out of SQL, in unix type in: rm -r

                                    & and that should do the trick

                                    I like pie.

                                    Comment

                                    • toddler
                                      Confirmed User
                                      • Jun 2002
                                      • 1911

                                      #19
                                      Originally posted by - Jesus Christ -
                                      Yea I'll just launched putty to try command line.... Webmin is Giving me this BS about a primary key.

                                      no cli? jesus typed man, no clicky of the mouse for him. you fuckimg imposter!
                                      http://www.flickr.com/photos/zoddler/

                                      Comment

                                      • - Jesus Christ -
                                        Confirmed User
                                        • Mar 2003
                                        • 7197

                                        #20
                                        I get this error.... right when I click edit.... (THis is BEFORE I have the chance to modify anything)

                                        "There seems to be an error in your SQL query. The MySQL server error output below, if there is any, may also help you in diagnosing the problem

                                        ERROR: Unclosed quote @ 342"



                                        Blach Fuck it... I'll jsut go hunt down the section of the PHP code the deals with this table an just set and absolute variable in the code and run it. I would have done that in the first place but its a huge piece of software and I figure Id try it like this first....


                                        Thanks anyway.



                                        BTW

                                        SHould I have an EMPTY databse called "phpmyadmin" ???

                                        Amen

                                        Comment

                                        Working...