PDA

View Full Version : PHP : error : operator not supported


PeterPan
3-21-04, 05:16 AM
Hi there

Im (relativly) new to PHP, & have created my first "biggish" PHP Script (im learning for work purposes - To convert one of my CGI scripts to PHP - So ive started on a smallish CGI script first - to practice :)

ANYWAYS - Before I babble on too much :-

On my home server - The script works perfectly fine....

However, when I upload to the powweb server - I get an error (after processing 3-4 lines correctly) :-

- COPY OF EMAIL BELOW - SENT TO PHP GROUP:-

=====================
But when I upload to the live web - 24/7 website, I get the error

Fatal error: [] operator not supported for strings in etc...

Ive marked the line with the error - by <<<

====
$lines = file('file-name');


foreach ($lines as $line_num => $line) {

echo "XA $line<BR>\n";
$pieces = explode(",", $line);
$tempa = strtolower($pieces[4]);
if ($line_num >0){$firstname[] = $tempa;}
$tempa = strtolower($pieces[3]);
if ($line_num >0){$surname[] = $tempa;} <<<< ERROR
$tempa = strtolower($pieces[1]);
if ($line_num >0){$region[] = $tempa;}
$tempa = strtolower($pieces[11]);
if ($line_num >0){$race[] = $tempa;}
}

====

Apparently, It processes 3 lines of data - & then causes the error
message...

Is strtolower - different from numbers / words ? - Or if it has a dash
" - " in the word/phrase ?

Is another command more suited ?

(looking through documentation for error messages :) )
=====================

PeterPan
3-21-04, 08:27 AM
Hi.

Ive fixed it.

Basically I was submitting a FORM, using a name - & within the PHP script - had created an array - Using the same names..

I changed it & now its going.

P