Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

easypopulate


bowen

Recommended Posts

Posted

hi all,

 

could some1 please help?

 

i am using the easypopulate which is an exellent addition and saves time, but with how our stock constantly changes i am after setting up a cron job to run the script automatically.

 

i have the csv file uploading to the server automatically from our pc along with images but i want the script to drop the current database (all product and stock related fields etc) then to upload the new csv file from the server to the database.

 

i know the following cron job works with my test uploads but obviously integrating this in the the OS codeing is beyond me!!

 

<?php

include ("includes/connect.php");

$drop='delete from stock';

if (@mysql_query($drop)) {
echo '<P>stock table succesfully deleted!</p>';
}else{
exit ('<p>error deleting table:  '.mysql_error().'</p>');}

$import='LOAD DATA local INFILE "./import.csv"
INTO TABLE stock
FIELDS TERMINATED BY ","
OPTIONALLY ENCLOSED BY """"
LINES TERMINATED BY "\r\n"
ignore 1 lines';
if (@mysql_query($import)) {
echo '<P>stock table succesfully loaded!</p>';
}else{
exit ('<p>error loading table:  '.mysql_error().'</p>');}

 ?>

 

can any1 please please help??

thanks in advance.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...