Reputation: 623
I got csv file that updates each few seconds and I want to auto import the csv file into the phpmyadmin table.
Those lines, as sql query, does the following, but only once:
TRUNCATE windUpdates;
LOAD DATA LOCAL INFILE "~/www/csvs/wtt.csv" INTO TABLE windUpdates FIELDS TERMINATED BY ',' ;
How can I to run these line automatically every 10 minutes ?
Upvotes: 0
Views: 8925
Reputation: 3686
I would simply write simple script that reads the CSV file, generates SQL query per line and then runs it on the mysql server. PhpMyAdmin isn't needed for that - just few lines of code.
(Not mine blog, and havn't tested it but this looks like great start point )
Once you have the working script (you can test it and perfect it by accessing it from you browser) you simply set it up in your hosting provider admin panel using bluehosts instructions:
From the cPanel, click the Cron Jobs icon and enter the following into the Command field:
/ramdisk/bin/php5 -c /home/USERNAME/PathTo/php.ini /home/USERNAME/public_html/PathToFile You may also want to adjust the settings specifying when to run the cron job. Note: You will need to replace USERNAME with your user ID and PathToFile with the file name or the rest of the path to the file.
Note: You may need to adjust /home/ to /home#/ depending on the home directory your account resides on. To view the home directory for your account simply view the stats column on the main cPanel page of your account and look for the home directory.
Note: To specify the php.ini file to use you may add "-c /home/USERNAME/PathTo/php.ini" to the cron job entry.
Upvotes: 1