SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Member
    Join Date
    Jul 2009
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question How to convert .txt file into MySQL

    Good Day Everybody,

    I'm am designing online store. My supplier is giving product information (images, product description, prices etc) in .txt file. The list is more than 9,000 long.

    How can I convert this information into MySQL and retrieve data whenever user clicks product for purchase, since my online store will be a dynamic site.

    I need to update the list almost daily as inventory from the supplier changes often.

    I need distinguished forum members' advice on this very basic question.

    NOTE: I'm new to site design and development and Sitepoint's books have been really helpful in guiding me thus far.

    Best wishes,
    Vijay
    (vjmetal@gmail.com)

  2. #2
    Barefoot on the Moon! silver trophy
    Force Flow's Avatar
    Join Date
    Jul 2003
    Location
    Northeastern USA
    Posts
    4,516
    Mentioned
    51 Post(s)
    Tagged
    1 Thread(s)
    Visit The Blog | Follow On Twitter
    301tool 1.1.5 - URL redirector & shortener (PHP/MySQL)
    Can be hosted on and utilize your own domain

  3. #3
    SitePoint Member
    Join Date
    Jul 2009
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Smile

    Thank you very much for the link. I appreciate your help.

  4. #4
    SitePoint Enthusiast freezea's Avatar
    Join Date
    Apr 2009
    Posts
    38
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi, astromax.

    A couple of things you can look at:

    PHP has a function called fgetcsv for importing CSV files, so you may be able to use that:
    http://us2.php.net/fgetcsv

    Alternatively, look into the mysql LOAD_DATA function:
    http://dev.mysql.com/doc/refman/5.0/en/load-data.html

    Regrads,
    freezea.
    RAQ Report: Web-based Excel-like Java reporting tool.

  5. #5
    SitePoint Wizard webcosmo's Avatar
    Join Date
    Oct 2007
    Location
    Boston, MA
    Posts
    1,432
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Sounds like you have to update inventory feed from vendors daily.

    Best approach is having a module that takes the data feed in text/csv or other possible formats and process it. Check out the file readers functions.

    And be sure not to process all data at once. Add some sort of interval using threading. Otherwise you might overload the database if there is too much data.

  6. #6
    SitePoint Member
    Join Date
    Jul 2009
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Smile

    Thank you to Freezea and Webcosmo for your pointers. It was very helpful.


Tags for this Thread

Bookmarks

Posting Permissions

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