hyeteck Posted March 17, 2008 Share Posted March 17, 2008 Hi, I am running mysql version 5.0.51-log. I have the following script. function update_prices() { $fullString = ""; $handle = @fopen("items.txt", "r"); if($handle && count(file("items.txt"))>1000) { $buffer = fgets($handle, 4096); while (!feof($handle)) { $buffer = fgets($handle, 4096); $chunks = explode(" ", $buffer); $prodId = $chunks[0]; $prodPrice = $chunks[1]; $prodPriceW = $prodPrice; $prodMap = $chunks[2]; $prodQuant = $chunks[3]; $prodSell = 1; $prodDisplay = 1; if($prodPrice==0) { $prodSell = 0; $prodDisplay = 0; //$result = mysql_query("UPDATE products SET pSell=0, pDisplay=0 WHERE pID='$prodId'") or die(mysql_error()); } else { if($prodPrice < 10) { $prodPrice *= 1.8; } elseif($prodPrice >= 10 && $prodPrice < 25) { $prodPrice *= 1.7; } elseif($prodPrice >= 25 && $prodPrice < 50) { $prodPrice *= 1.6; } elseif($prodPrice >= 50 && $prodPrice < 100) { $prodPrice *= 1.5; } elseif($prodPrice >= 100 && $prodPrice < 200) { $prodPrice *= 1.3; } elseif($prodPrice >= 200 && $prodPrice < 300) { $prodPrice *= 1.09; } elseif($prodPrice >= 300 && $prodPrice < 400) { $prodPrice *= 1.08; } elseif($prodPrice >= 400 && $prodPrice < 500) { $prodPrice *= 1.13; } elseif($prodPrice >= 500 && $prodPrice < 600) { $prodPrice *= 1.12; } elseif($prodPrice >= 600 && $prodPrice < 700) { $prodPrice *= 1.11; } elseif($prodPrice >= 700 && $prodPrice < 800) { $prodPrice *= 1.10; } elseif($prodPrice >= 800 && $prodPrice < 900) { $prodPrice *= 1.09; } elseif($prodPrice >= 900 && $prodPrice < 1000) { $prodPrice *= 1.08; } else { $prodPrice *= 1.07; } $prodPrice = floor($prodPrice); $prodPrice += 0.99; print $prodId . "\n"; $fullString .= $prodId . "," . $prodPrice . "," . $prodQuant . "," . $prodMap . "," . $prodPriceW . "," . $prodSell . "," . $prodDisplay . "\n"; //$result = mysql_query("UPDATE products SET pPrice=IF(pFreight = 1,'$prodPrice + 90','$prodPrice'), pInStock='$prodQuant', pMapprice='$prodMap', pWholesalePrice='$prodPriceW' WHERE pID='$prodId'") or die(mysql_error()); } } } fclose($handle); $fh = fopen("outfile.txt", 'w') or die("can't open file"); fwrite($fh, $fullString); fclose($fh); $rs = mysql_query("LOAD DATA LOCAL INFILE 'outputfile.txt' REPLACE INTO TABLE products (pID, pPrice, pInStock, pMapprice, pWholesalePrice, pSell, pDisplay)") or die(mysql_error()); } and its spitting out the following error: The used command is not allowed with this MySQL version I couldn't find anything about not allowing the LOAD DATA LOCAL INFILE command to run on my mysql version. Link to comment https://forums.phpfreaks.com/topic/96495-command-not-allowed-with-mysql-version/ Share on other sites More sharing options...
fenway Posted March 17, 2008 Share Posted March 17, 2008 From which statement? Link to comment https://forums.phpfreaks.com/topic/96495-command-not-allowed-with-mysql-version/#findComment-493991 Share on other sites More sharing options...
hyeteck Posted March 17, 2008 Author Share Posted March 17, 2008 I only have one statement in there. Its the following one: $rs = mysql_query("LOAD DATA LOCAL INFILE 'outputfile.txt' REPLACE INTO TABLE products (pID, pPrice, pInStock, pMapprice, pWholesalePrice, pSell, pDisplay)") or die(mysql_error()); Link to comment https://forums.phpfreaks.com/topic/96495-command-not-allowed-with-mysql-version/#findComment-494173 Share on other sites More sharing options...
fenway Posted March 17, 2008 Share Posted March 17, 2008 See here -- LOCAL is a potential security hole, so it may be off by default. Link to comment https://forums.phpfreaks.com/topic/96495-command-not-allowed-with-mysql-version/#findComment-494187 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.