Results 1 to 3 of 3
  1. #1
    Action Jackson - King of the World
    Join Date
    January 18th, 2005
    Posts
    2,201
    Inserting text into db
    Hi all:

    I am trying to figure if there is a way I can from Mysql load a feed and have it create either the tables based on the category name or add products if the table name already exists. Everything I've found so far seems to name the table after the name of the file and this will definitely not work. Can anyone point me in the right direction?

  2. #2
    Newbie
    Join Date
    December 5th, 2005
    Posts
    10
    Need some more info
    I've been doing something that sounds similar recently, but not sure exactly what you're looking for.

    Mark

  3. #3
    Member YetAnotherAffiliate's Avatar
    Join Date
    October 28th, 2005
    Location
    Ohio
    Posts
    48
    Question
    Not too sure on what you need, but will this help?

    PHP Code:
    // create table
    @mysql_db_query($_POST[dbname], "DROP TABLE IF EXISTS $_POST[dbtbl]"$link);
    if(!
    mysql_db_query($_POST[dbname], "CREATE TABLE $_POST[dbtbl] (id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
    column1 INT(10) UNSIGNED,
    column2 INT(10) UNSIGNED,
    column3 CHAR(2))"
    $link))
    $error .= 'Unable to create table '.mysql_error($link).'<br/><br/>';


    // load table
    if($_GET[load]) {
    $link mysql_connect($dbhost$dbuser$dbpass);
    mysql_db_query($dbname"DELETE FROM $dbtbl"$link);
    $fp fopen('data/data.csv''r');
    while(!
    feof($fp)) {
    $line trim(fgets($fp));
    $line explode(','$line);
    mysql_db_query($dbname"INSERT INTO $dbtbl VALUES('0', '$line[0]', '$line[1]', '$line[2]')"$link);
    $count++;
    }
    if(!
    mysql_error($link))
    $message 'table loaded successfully ( '.$count.' ).<br/><br/>.';
    mysql_close($link);


    Regards,
    Brad

  4. Newsletter Signup

+ Reply to Thread

Similar Threads

  1. Having problem inserting my avatar
    By Web-King in forum Newbie Affiliate FAQs & Helpful Articles
    Replies: 3
    Last Post: October 23rd, 2013, 05:36 PM
  2. Inserting random numbers?
    By lulav in forum WebMerge (Fourthworld.com)
    Replies: 8
    Last Post: November 12th, 2009, 06:57 AM
  3. WM-IndexLabel and inserting blanks
    By adamxcl in forum WebMerge (Fourthworld.com)
    Replies: 2
    Last Post: October 7th, 2009, 01:58 PM
  4. Inserting datafeed into MySql
    By RH&A in forum ShareASale - SAS
    Replies: 12
    Last Post: March 7th, 2007, 10:39 AM
  5. inserting php in ssi
    By Cursal in forum Programming / Datafeeds / Tools
    Replies: 6
    Last Post: December 21st, 2005, 10:04 PM

Posting Permissions

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