function and global problems

From: Date: Fri, 06 Apr 2001 05:59:26 +0000
Subject: function and global problems
Groups: php.general 
Request: Send a blank email to php-general+get-47405@lists.php.net to get a copy of this message
I can not seem to get this figuered out I whant to run this function to pull data out of a file and thin use the data in the rest of the program. When I do this I get a Parse error: parse error in c:/httpd/htdocs/autosetup/auto/test.php on line 25 <?php function getdata( ){ ############################################################################ ##### global $domain,$tld,$firstname,$lastname,$userid,$passw,$email,$package, $frontpage,$mysql,$userdatabase,$newuser,$newuserpass; if(file_exists("userdata")) { $fp2=fopen ("userdata","r")or die("unable to open file ($userdata)"); flock($fp2, 2); //unless ($use_flock == 0); while ($data = fgetcsv ($fp2, 1000, "|")) { $num = count ($data); $row++; for ($c=0; $c<$num; $c++) { } list($domain,$tld,$firstname,$lastname,$userid,$passw,$email,$package, $frontpage,$mysql,$userdatabase,$newuser,$newuserpass) = $data; } //close and del file fclose ($fp2); //system ("del userdata"); } getdata( ) echo $domain; <--This is line 25 which is outside of the function echo $tld; echo $firstname; echo $lastname; echo $userid; echo $passw; echo $email; echo $package; echo $frontpage; echo $mysql; echo $userdatabase; echo $newuser; echo $newuserpass; ?>

« previous php.general (#47405) next »