New line = new entry [PHP & MySQL]

Discussion in 'PHP' started by myJava, Jan 18, 2009.

  1. #1
    Hello everyone!

    So what's all about? I have simple form with one field and the user must enter different codes for example:
    12345
    3333
    12932
    4444

    Eeach code is in a new line. And i want php to add them to my MySQL database as different entries. How can i do that? I'm looking only for the php code, the mysql commands are ok for me. Thanks in advance!
     
    myJava, Jan 18, 2009 IP
  2. IGonza

    IGonza Peon

    Messages:
    406
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #2
    try :
    $rows = explode ("\n", $_POST['your_field']);
    You will get an array with the lines.
     
    IGonza, Jan 18, 2009 IP
  3. myJava

    myJava Peon

    Messages:
    15
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thank you very much! It works for me :)
     
    myJava, Jan 18, 2009 IP