Results 1 to 2 of 2

Thread: Import Text file to and from Database

Threaded View

  1. #1
    Join Date
    Sep 2009
    oxfordshire, england

    Import Text file to and from Database

    Hi Everyone,

    A bit of help needed as my MYSQL is terrible.

    I have a database that looks as follows:

    attribute id - value
    64           - 109.txt
    109          - some other data
    110          - some other data
    64           - 110.txt
    109          - some other data
    110          - some other data
    I then have a php script that can read the text document here:

    <?php $lines = file('http://www.mywebsite.com/files.txt'); ?>
    I need to grab that text file from my database, where attribute id = 64 leaving the "other data" as it is. Then open the txt file in php and put the contents back into that exact field it got them from.

    the table name is "mage_catalogsearch_fulltext" for reference

    The reason for me doing this is the product descriptions are all inside those text documents, and I need to suck them out and put the actual content into that field rather than the file reference

    I am more of a designer but am piecing the php together slowly so far I am connecting to the database and trying to get the files:
    mysql_connect ("localhost","cpsdev_mage1","**********"); 
    mysql_select_db ("cpsdev_mage1"); 
    $sql = "select 'value' from mage_catalogsearch_fulltext WHERE 'Attribute_id' = 64"; 
    $result = mysql_query ($sql) or die($myQuery."<br/><br/>".mysql_error()); 
    while($row = mysql_fetch_array($result))
      echo $row['value'];
    This does not do the job however

    Any help is greatly appreciated. Simon
    Last edited by simonstaton; 10-29-2012 at 07:24 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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