Results 1 to 7 of 7
  1. #1
    Join Date
    Feb 2002
    Location
    NY
    Posts
    169

    mysql and changing data

    Hello,

    I want to be able to change information on a table without having to do it one at a time. There are about 300+ records I need to change and don't know what would be the best way to do this.

    The records consist of binary files as well as other info.

    Here is a sample structure:

    ID
    Uploaded
    Downloaded
    FileSize
    FileMD5
    FileData
    FileType
    AddToGallery
    KeepAround
    Width
    Height
    Seen

    Currently KeepAround is set at 0 (zero) which means at a given time the file will automatically be removed from the database. What I want to do is change this table to 1 for all the records.

    I know I can do this one at a time via phpmyadmin but this will take forever. If I download the .sql file, its will show the binary characters of each file and will not work. (tried this already)

    Is there a method to do this?
    "To steal ideas from one person is plagiarism; to steal from many is research."

  2. #2
    Join Date
    Oct 2002
    Location
    State of Disbelief
    Posts
    22,951
    Try this from phpMyAdmin, but back up the database first. If it goes wrong, it would be hell to put right without a backup to revert to. This does not check to see if the record contains more than "0", so be careful.
    Code:
    UPDATE database_name
    SET KeepAround=(
    REPLACE (KeepAround,
    '0',
    '1'));
    Having problems, or maybe questions about WHT? Head over to the help desk!

  3. #3
    Join Date
    Feb 2002
    Location
    NY
    Posts
    169
    I am working from a test database that has the same data so I don't have to try this on the live database.

    You said to try the code from phpmyadmin. Where would I enter this from?

    Thanks
    "To steal ideas from one person is plagiarism; to steal from many is research."

  4. #4
    Join Date
    Oct 2002
    Location
    State of Disbelief
    Posts
    22,951
    Assuming you have phpmyadmin installed on your server:
    In phpMy Admin is a tab called "SQL". After selecting the correct database, click that, and there should be a box to enter this query.
    Having problems, or maybe questions about WHT? Head over to the help desk!

  5. #5
    Join Date
    Feb 2002
    Location
    NY
    Posts
    169
    Ok,

    I give it a go shortly and see if it worked.
    "To steal ideas from one person is plagiarism; to steal from many is research."

  6. #6
    Join Date
    Feb 2002
    Location
    NY
    Posts
    169
    This worked!

    Thanks.....
    "To steal ideas from one person is plagiarism; to steal from many is research."

  7. #7
    Join Date
    Oct 2002
    Location
    State of Disbelief
    Posts
    22,951
    Excellent, happy it worked for you.
    Having problems, or maybe questions about WHT? Head over to the help desk!

Posting Permissions

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