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

  • SEARCH
  • Home
  • 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 8874389
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T18:42:26+00:00 2026-06-14T18:42:26+00:00

I have a csv file which contains 2000 data in one single column. The

  • 0

I have a csv file which contains 2000 data in one single column. The data format is like following:

name 100/1
name 100/2
name 105/6 
 ...

So the general format is ‘text integer_one/integer_two’ Now I want it to store in a mysql database table with 2 columns. column_1 should have the data integer_one, and column_2 should have the data integer_two

How can I do this using php to push the data into mysql?

  • 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-14T18:42:28+00:00Added an answer on June 14, 2026 at 6:42 pm

    First start by extracting your values. If all your data is formated like in your example, you can use a simple explode.

    $lines = explode(",", $data); // $data should be your file extracted into a string
    foreach ($lines as $line) {
        $temp = explode(" ", $line);
        $name = $temp[0];
        $temp_2 = explode("/", $temp[1]);
        $integer_1 = $temp_2[0];
        $integer_2 = $temp_2[1];
    
        $query = "INSERT INTO table_two_columns SET name = '{$name}', integer_1 = '{$integer_1}', integer_2 = '{$integer_2}'";
    }
    

    Well that’s my take on your problem.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a csv file which contains a column named query. One of the
i have one csv file which contains library group and it's data... group consider
Suppose we have a csv file(>5GB) which contains Employee name and Age column. The
I have a CSV file which has the following format: id,case1,case2,case3 Here is a
I have an .sql file which contains some data like first_name, last_name, email etc.
I have a CSV file (exported data from iWork Numbers) which contains of a
I have a NSString *csvData which contains the csv data and the format is
I have a CSV file which contains data seperated with tabs. I need to
I have a Testing project that contains a csv file which a webtest uses
I have .zip file which contain csv data. I am reading .zip file using

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.