MySQL Forums
Forum List  »  MySQL Query Browser

cron job mysql script
Posted by: Martin Bowman
Date: February 02, 2012 06:40AM

I am trying to create a cron job script that clears the product_quantity tabe in an oscommerce database then loads the stock numers from a CSV stream. This is what I have come up with so far but think I need a little help to correct it please. :)

<?php

$hostname_mysql_server = "SERVER_ADDRESS";
$database_mysql_server = "DATABASE_NAME";
$username_mysql_server = "USERNAME";
$password_mysql_server = "PASSWORD";

$row = 1; // init row counter

$handle = fopen("http://www.1on1dropship.co.uk/members_area/feeds.2.0/status-feed.asp?uname=USERNAMEpwd=PASSWORD";, "r"); // open for read-only access
while (($data = fgetcsv($handle, 1000000, ",")) !== FALSE) {

$sql="SELECT `products`.`products_id` AS 'prod_id' FROM `products` INNER JOIN `products_description` ON `products`.`products_id`=`products_description`.`products_id` WHERE `products_description`.`products_name`=\"{$data[3]}\" AND `products`.`products_model`=\"{$data[1]}\" LIMIT 1;";

$sql="TRUNCATE TABEL `products`.`products_quantity`";

$sql= "INSERT INTO `products` SET
`products_quantity`='{$data[18]}'
;";

}

?>

Options: ReplyQuote


Subject
Written By
Posted
cron job mysql script
February 02, 2012 06:40AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.