Run PHP script doesn’t work
-
Hi!
I’m trying to set up a fixed interval schedule to run a PHP script, but it doesn’t run.
The “Nest run”-time doesn’t update either.I have the following setup
Run every 10 minutes
Action: Run PHP-script
Custom action: None
Argument (optional): None
PHP script path: URL to the php-file with the scriptHere is the scrpt inside the PHP-file
<?php //set the connection variables $hostname = ""; $username = ""; $password = ""; $database = ""; $filename = ""; //connect to mysql database $connection = mysqli_connect($hostname, $username, $password, $database) or die("Error " . mysqli_error($connection)); mysqli_query($connection, "TRUNCATE TABLE <code>Pristabell</code>"); // open the csv file $fp = fopen($filename,"r"); //parse the csv file row by row while(($row = fgetcsv($fp,"500",",")) != FALSE) { //insert csv data into mysql table $sql = "INSERT INTO Pristabell (Produkt, Pris, Rabattkr, Rabattprosent, Lagerstatus, Butikk, TAGS) VALUES('" . implode("','",$row) . "')"; if(!mysqli_query($connection, $sql)) { die('Error : ' . mysqli_error($connection)); } } fclose($fp); //close the db connection mysqli_close($connection); ?>
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Run PHP script doesn’t work’ is closed to new replies.