Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

php mysql question

  • 12-07-2007 09:48AM
    #1
    Registered Users, Registered Users 2 Posts: 648 ✭✭✭


    hi i have a large db and when i export it i get

    INSERT INTO `places` VALUES (294, 'ae', 'badiya', 'Badiya', '04', '25.4313889', '56.3483333\n', 0, '');


    anyone know how to get rid of the \n you see above - considering i have 2.5 mil rows on that table?

    tnx


Comments

  • Registered Users, Registered Users 2 Posts: 68,173 ✭✭✭✭seamus


    You could use the replace() function to remove all of the trailing \n's.

    I'd say test it before doing anything with it. Compare the below queries;

    SELECT myCol FROM places LIMIT 0, 50
    SELECT REPLACE(myCol, '\n', '') FROM places LIMIT 0, 50

    The first should give you the raw data, the second should give you the same data, just with the newline characters removed.

    I'm also not sure if MySQL recognises the \n as a newlines character. Try

    SELECT RTRIM(myCol) from Places LIMIT 0, 50

    And see what it shows you.


Advertisement