Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $servername = "localhost";
- $username = "root";
- $password = "password";
- $dbname = "csv";
- // Create connection
- $conn = new mysqli($servername, $username, $password, $dbname);
- // Check connection
- if ($conn->connect_error) {
- die("Connection failed: " . $conn->connect_error);
- }
- LOAD DATA INFILE 'shop1.csv'
- INTO TABLE pricetrend
- FIELDS TERMINATED BY ',' ENCLOSED BY '"'
- LINES TERMINATED BY 'rn'
- IGNORE 1 LINES;
- $sql = "INSERT into pricetrend (aw_deep_link, product_name, aw_product_id,
- merchant_product_id, merchant_image_url, description, merchant_category,
- search_price, merchant_name, merchant_id, category_name, category_id,
- aw_image_url, currency, store_price, delivery_cost, merchant_deep_link,
- language, last_updated, display_price, data_feed_id, brand_name, brand_id,
- colour, product_short_description, specifications, condition, product_model,
- model_number, dimensions, keywords)";
- ?>
Add Comment
Please, Sign In to add comment