SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    perfect = good enough peach's Avatar
    Join Date
    Jun 2004
    Location
    -Netherlands-
    Posts
    1,384
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    downloading the db and putting it back up

    Hi,

    I want to download the entire SQL database and run a " search and replace" through it, to remove some backslashes that spawned in item titles.
    How do I go about and do this? Of course when Im done replacing, I want to put the database back where it was, and it better not break .

    I have cpanel and phpmyadmin.

    I already managed to export the database into a textfield, but I didnt see an option to "safe" or "update" the db.

    Thanx, JR

  2. #2
    SitePoint Evangelist
    Join Date
    Apr 2005
    Location
    Moscow, Russia
    Posts
    557
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi, are you talking about MySQL dump files (plain text files storing DDL & DML statements) where you want to perform search & replace? BTW search & replace can be done without doing database backup and restoring it back, i.e. using UPDATE statement. Would you provide a few sample rows with backslashes to be removed?

  3. #3
    perfect = good enough peach's Avatar
    Join Date
    Jun 2004
    Location
    -Netherlands-
    Posts
    1,384
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Tangerine_Dream
    Hi, are you talking about MySQL dump files (plain text files storing DDL & DML statements) where you want to perform search & replace? BTW search & replace can be done without doing database backup and restoring it back, i.e. using UPDATE statement. Would you provide a few sample rows with backslashes to be removed?

    Hmm after having a closer look at the db, the backslashes are not there. Now Im even more confused. In the CMS, the backslashes are there, and they also show on the website itself. If I remove the backslash in an item name, it disappears for good.

    So is this a magic quotes problem or something? Maybe I looked at the wrong place in the db. The backslash is always right before a ' . So on the site it reads [i]Don/'t[i/], but on the DB browsing page it says Don't

    :S

  4. #4
    perfect = good enough peach's Avatar
    Join Date
    Jun 2004
    Location
    -Netherlands-
    Posts
    1,384
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    .. now I checked out what it looks like when I press export, and every place where there is a ' in the text, there are 2 single quotes: '' :s

  5. #5
    SitePoint Evangelist
    Join Date
    Apr 2005
    Location
    Moscow, Russia
    Posts
    557
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    So is this a magic quotes problem or something? Maybe I looked at the wrong place in the db. The backslash is always right before a ' . So on the site it reads Don/'t[i/], but on the DB browsing page it says [i]Don't
    Yes, it's because backslash used as escape character in MySQL. You should check your CMS' PHP code why it shows unnecessary backslashes. Check 9.1.1. Strings and stripslashes

    .. now I checked out what it looks like when I press export, and every place where there is a ' in the text, there are 2 single quotes: '' :s
    Since single quote chararacter in MySQL used to specify string values, so when single quote char is required within a string, it should be either escaped or replaced with 2 single quotes


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
  •