Results 1 to 4 of 4
  1. #1
    4 Star Lounger
    Join Date
    Mar 2002
    Location
    Sacramento, California, USA
    Posts
    509
    Thanks
    4
    Thanked 1 Time in 1 Post
    How does one insert a newline character into a character field using phpMyAdmin?

    phpMyAdmin apparently doesn't recognize an escape character. All of the instructions I've found say that if you want a special character you just type or paste it. Unfortunately you can't type a newline in a phpMyAdmin field; it interprets the character as a click on the "Go" button. Nor can you paste one; if you try, nothing happens.

    BTW, I'm hoping for a solution that a non-technical client can use. I know I could do this by writing a SQL query, for example, but that won't really give me what I need.

  2. #2
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts
    Quote Originally Posted by jsachs177 View Post
    How does one insert a newline character into a character field using phpMyAdmin?
    Does Shift+Enter work? I mean, it will cause the cursor to move to the next line in a <textarea>, but does it insert the correct character?

  3. #3
    4 Star Lounger
    Join Date
    Mar 2002
    Location
    Sacramento, California, USA
    Posts
    509
    Thanks
    4
    Thanked 1 Time in 1 Post
    phpMyAdmin considers Shift+Enter no different from Enter alone.

    I looked at the source sent to the browser and found that the form is one huge piece Javascript. I didn't try to figure out what it's doing, but it appears to edit character fields in <input type="text">, not textareas.

  4. #4
    New Lounger
    Join Date
    Jan 2010
    Location
    London
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    The problem I'm guessing is that phpmyadmin form, being text only, only accepts standard printing ascii characters, and so it does not accept the first 32 non-printing ones (which includes your desired carriage return). There is no real workaround, unless, as you say, you insert it directly with an sql query that stores the ascii character, since typing the ascii code using the Alt key + code usually fails too.

    However in standard use, you should not store a carriage return in a database, rather you should store an interpreted carriage return, so newline
    Code:
    \n
    and carriage return
    Code:
    \r
    characters which are valid for javascript, php etc, or if using html and then when viewing the data, interpret it.

Posting Permissions

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