Jump to content

Swarnima_Yagyasaini

New Members
  • Posts

    1
  • Joined

  • Last visited

Everything posted by Swarnima_Yagyasaini

  1. sir i want to import a csv file to mysql. my program is right for only a particular csv file not for all. I want to do it for all the file that i select. I used $filename = $_FILES['file']['tmp_name'] but it also didnt work. this is my code <?php if(isset($_POST['submit'])) { $connect = mysql_connect('127.0.0.1','root',''); if (!$connect) { die('Could not connect to MySQL: ' . mysql_error()); } $cid =mysql_select_db('ts_order_track',$connect); $q="LOAD DATA LOCAL INFILE '"trendspry.csv"' REPLACE INTO TABLE tsd_orders FIELDS TERMINATED BY ',' ENCLOSED BY '\"' LINES TERMINATED BY '\n' IGNORE 1 LINES ( order_id, customer_id, firstname, lastname, email, telephone, mobile, shipping_firstname, shipping_lastname, shipping_mobile, shipping_address_1, shipping_address_2, shipping_city, shipping_zone, shipping_postcode, shipping_country, shipping_method, payment_method, payment_code, weight, date_added, date_modified, import_order_id, sub_total, shipping_charges, tax_charges, total, order_status, courier, awb_code, coupon_amount, coupon_code, product_name, product_sku, product_model, product_quantity, product_price )"; $s=mysql_query($q, $connect ); echo "$q"; echo "File data successfully imported to database!!"; mysql_close ( $connect ); } ?> I didnt understand how to use $_FILES['file']['tmp_name'] here. plz help me.. thanx in advance.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.