Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8472361
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T17:02:55+00:00 2026-06-10T17:02:55+00:00

I have a textarea that is populated with values. On submit button, I’m saving

  • 0

I have a textarea that is populated with values. On submit button, I’m saving the value of textarea in a table in separate rows using this code:

echo "<center><textarea name='resulta' id='result' style='height:200px; width:350px' readonly=readonly></textarea></center>";
echo "<form><center><input type=submit name=subs value='Submit'></center></form>";
$val=$_POST['resulta'];

    if (isset($_POST['subs']))
    {

        $lines = explode("\n", $val);

    foreach ($lines as $line) 
    {
        mysql_query("insert into postflight (sample_lang) values ('$line')") or die(mysql_error());

    }

If I have inputted the following in the textarea:

Tokyo - London -> 10:00:00
London - Tokyo -> 11:00:00

The postflight table will have these data respectively,

sfno  || bltime   || sample_lang
00001 || 00:00:00 || Tokyo - London -> 10:00:00
00002 || 00:00:00 || London - Tokyo -> 11:00:00

But, what I want to do is, add to sample_lang column ‘Tokyo – London’ then add to bltime column ’10:00:00′. The data in the postflight should look like this:

sfno  || bltime   || sample_lang
00001 || 10:00:00 || Tokyo - London
00002 || 11:00:00 || London - Tokyo

I have tried several MySQL string functions like explode, locate, trim but can’t get it to properly work. I’m not that familiar with MySQL string functions so I’m having a hard time getting this to work. Any ideas on how to do this will be appreciated. Thanks a lot!

EDIT:
I’m not limiting the possible solutions to MySQL string functions only. Of course I’m open to PHP solutions as well. I just stated what I’ve done so far to get this work. Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T17:02:57+00:00Added an answer on June 10, 2026 at 5:02 pm

    While this is technically possible to do purely in MySQL, what makes you think it’s your only option?

    It’s really far easier to do string parsing in PHP.

    foreach ($lines as $line) 
    {
        $fields = explode('->', $line);
        $sample_lang = trim($fields[0]);
        $bltime = trim($fields[1]);
        mysql_query("insert into postflight (bltime, sample_lang) values ('".mysql_escape_string($bltime)."','".mysql_escape_string($sample_lang)."' )") or die(mysql_error());
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

here's an easy one (that I'm struggling with)! I have a textarea, a button,
I have this following setup, a textarea named with some data in it that
In my GSP page, I have this form: <g:form action=ajaxAdd> <g:textArea id='postContent' name=content rows=3
I have a textarea that contains phone numbers, each number in a separate line.
I have a field in the database that get populated from a textarea. I
I have a textarea on a form that is populated with text from a
I have a simple like this: <textarea id=ind_comment rows=4 cols=32></textarea> Then I have the
I have this following string that I am trying to populate a textarea with
I have a TextArea component called labels that will be populated by Strings in
I have a textarea that I might want to disable in certain conditions. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.