Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Senior Coder
    Join Date
    Jun 2008
    Location
    New Jersey
    Posts
    2,546
    Thanks
    45
    Thanked 259 Times in 256 Posts

    Unable to copy data from one SQL table to another

    I've had an ongoing project for a while in where I had to grab data from an API and make use of it. The data needed to be stored for historical reference, but due to specific requests by the person I was making it for, I stored the data as the resulting XML (eg, in a text column). That XML was read when needed and parsed as needed.

    Obviously though, this is far from efficient, plus added a lot more data then was necessary.

    Finally, the project is under new management and I'm looking to convert all the stored XML data into individual columns. I wrote up a script that would pull the XML, read it, and then break it up as appropriate, no problems.

    The only issue I had is that some of the data are Greek characters, which read just fine from the XML data, but when I try to insert them into their new destinations, don't store properly, and I have no idea why. I can read the data from the XML, it displays properly when echo'ed, but when I try to then insert the same data it displays, it shows up the same in phpMyAdmin but shows up malformed when I select/echo it back out.

    So at this point, I'm not sure if this is a PHP or MySQL issue. The only difference between the two tables is that one is MyISAM and the other InnoDB, which I don't think should make a difference here. Otherwise, I can only imagine there's some issue I am unaware of that I need to to do to get the characters to copy properly.

    Any thoughts/advice?

  • #2
    Senior Coder djm0219's Avatar
    Join Date
    Aug 2003
    Location
    Wake Forest, North Carolina
    Posts
    1,313
    Thanks
    4
    Thanked 207 Times in 204 Posts
    What is the collation for the table and the column(s) involved? If they aren't UTF that may be the reason. I use utf8_unicode_ci for tables and columns so they will work with anything.
    Dave .... HostMonster for all of your hosting needs

  • #3
    Senior Coder
    Join Date
    Jun 2008
    Location
    New Jersey
    Posts
    2,546
    Thanks
    45
    Thanked 259 Times in 256 Posts
    Quote Originally Posted by djm0219 View Post
    What is the collation for the table and the column(s) involved? If they aren't UTF that may be the reason. I use utf8_unicode_ci for tables and columns so they will work with anything.
    Both are latin1_swedish_ci. The fact that its the same is why I'm a bit confused, when one contains the correct data, but I can't seem to get the same data into the other :-/

  • #4
    Senior Coder
    Join Date
    Jun 2008
    Location
    New Jersey
    Posts
    2,546
    Thanks
    45
    Thanked 259 Times in 256 Posts
    Does PHP have language settings like MySQL does? Maybe that's the issue?


  •  

    Tags for this Thread

    Posting Permissions

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