Jump to content

Command not allowed with mysql version


hyeteck

Recommended Posts

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
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.