Guest User

Untitled

a guest
Jun 15th, 2018
432
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. <?php
  2. $servername = "localhost";
  3. $username = "root";
  4. $password = "password";
  5. $dbname = "csv";
  6.  
  7. // Create connection
  8. $conn = new mysqli($servername, $username, $password, $dbname);
  9.  
  10. // Check connection
  11. if ($conn->connect_error) {
  12. die("Connection failed: " . $conn->connect_error);
  13. }
  14.  
  15. LOAD DATA INFILE 'shop1.csv'
  16. INTO TABLE pricetrend
  17. FIELDS TERMINATED BY ',' ENCLOSED BY '"'
  18. LINES TERMINATED BY 'rn'
  19. IGNORE 1 LINES;
  20.  
  21. $sql = "INSERT into pricetrend (aw_deep_link, product_name, aw_product_id,
  22. merchant_product_id, merchant_image_url, description, merchant_category,
  23. search_price, merchant_name, merchant_id, category_name, category_id,
  24. aw_image_url, currency, store_price, delivery_cost, merchant_deep_link,
  25. language, last_updated, display_price, data_feed_id, brand_name, brand_id,
  26. colour, product_short_description, specifications, condition, product_model,
  27. model_number, dimensions, keywords)";
  28. ?>
Add Comment
Please, Sign In to add comment