DotDragnet
February 08, 2012, 08:24:04 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Welcome to the new trading eye refugees
 
   Home   Help Search Login Register  
Pages: [1]   Go Down
  Print  
Author Topic: PHP - unexpected T_STRING, expecting ',' or ';'  (Read 636 times)
Whatever
Hero Member
*****
Posts: 715



View Profile WWW Awards
« on: May 03, 2010, 09:48:53 PM »

I have modified an old file I had to read a .csv file and output just a few bits of data from the original, including some maths with prices. However, I get an error of:

Quote
Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in public_html/imports/change_prices.php on line 70

Here's my script. Line 70 is:
Quote
if($matrix_band_pricing_flag != 'N') {

Code:
<?php

error_reporting
(E_ALL);
ini_set('display_errors',1);
echo 
"Starting"."\n";


// Load file 
$handle fopen('spicerf2.csv'"r");


// Set csv column headers
$output "store,websites,sku,price,rrp\n";


$i=0;


// Is there data?
while($data fgetcsv($handle1000","))


{

if($i!=0) {

// Set the variables
$sku $data[0];
$price $data[10];
$rrp $data[9];
$martix_band_pricing_flag $data[31];


// Convert trade and rrp prices to pence
$price $price 100;
$rrp $rrp 100;


// Update sales price depending upon Matrix Band Price Flag
switch($matrix_band_pricing_flag) {
case 'A'  $percent 0.70;
break;
case 'B' :   $percent 0.70;
break;
         
case 'C' :             $percent 0.75;
                                                                break;
case 'D'  $percent 0.85;
break;
case 'E'  $percent 0.88;
break;
case 'F'  $percent 0.60;
break;
case 'G'  $percent 0.75;
break;
case 'H' :              $percent 0.75;
break;
case 'N'  $percent 0.70;
break;
}
$price $price $percent;
$price number_format($price2'.''');


// Display data as file runs
echo $data[0].' - '.$sku.' - '.$price.' - '.$rrp.';
echo "\n";


// Output result to csv file
if($matrix_band_pricing_flag != '
N') {
$output .= '
admin,base,"'.$sku.'","'.$price.'","'.$rrp.'"';
$output .= "\n";
}


unset($rrp);
unset($price);
unset($matrix_band_price_flag);
}
++$i;
}
file_put_contents('
./update_sell_price.csv', $output);

mysql_close($conn);
echo "\n"."Done";

I just can't suss it...
Logged

Office Stationery : Paper : Inks & Toners
10% off first 3 orders for registered users. Use the code DDN10
SLEE
Hero Member
*****
Posts: 816



View Profile WWW Awards
« Reply #1 on: May 04, 2010, 12:04:29 AM »

you have an extra single quote

replace this:

Code:
echo $data[0].' - '.$sku.' - '.$price.' - '.$rrp.';

with:

Code:
echo $data[0].' - '.$sku.' - '.$price.' - '.$rrp;
Logged

SLEE - still the most confusing ddner...

Follow me on Twitter
Whatever
Hero Member
*****
Posts: 715



View Profile WWW Awards
« Reply #2 on: May 04, 2010, 07:34:08 AM »

Fantastic! Thanks Lee.
Logged

Office Stationery : Paper : Inks & Toners
10% off first 3 orders for registered users. Use the code DDN10
Pages: [1]   Go Up
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF | SMF © 2006-2008, Simple Machines Valid XHTML 1.0! Valid CSS!