Flat file script

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Smackie
Forum Contributor
Posts: 302
Joined: Sat Jan 29, 2005 2:33 pm

Flat file script

Post by Smackie »

hello i created a flat file script and well i have alil problem now here is the script

Code: Select all

<?
$Lines = file("data.txt");

foreach($Lines as $Key => $Val) 
{
   //explode that data into a new array:  
   $Data[$Key] = explode("||", $Val);
}

for($K = 0; $K < sizeof($Lines); $K++) 
{ 
   echo '<p>';   
   echo 'Rank: '.$Data[$K][0].'<br>'
   echo 'Callsign: '.$Data[$K][1].'<br>'
   echo 'Duty: '.$Data[$K][2].'<br>'
   echo '</p>';
}
?>
and i get this error
Parse error: syntax error, unexpected T_ECHO, expecting ',' or ';' in /home/gnsf/public_html/test/home.php on line 14
can someone help thank you
Smackie
alex.barylski
DevNet Evangelist
Posts: 6267
Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg

Post by alex.barylski »

Look at the end of youe echo your missing semi-colons...
Smackie
Forum Contributor
Posts: 302
Joined: Sat Jan 29, 2005 2:33 pm

Post by Smackie »

thank you lol i been looking at the binary in school all week lol and yeah lol
Smackie
Forum Contributor
Posts: 302
Joined: Sat Jan 29, 2005 2:33 pm

Post by Smackie »

ummm i have a question what should the main.php page and the data.php page should be for CHMOD
Smackie
Forum Contributor
Posts: 302
Joined: Sat Jan 29, 2005 2:33 pm

Post by Smackie »

Can someone tell me why im just getting a blank on this script? it should come up with like a place to enter a rank, a callsign, and a duty but its not

Code: Select all

<?
$Lines = file("data.txt");

foreach($Lines as $Key => $Val) 
{
 //explode that data into a new array: 
$Data[$Key] = explode("||", $Val); } for($K = 0; $K < sizeof($Lines); $K++) 
{    

   echo '<p>';    
   echo 'Rank: '.$Data[$K][0].'<br>';
   echo 'Callsign: '.$Data[$K][1].'<br>'; 
   echo 'Duty: '.$Data[$K][2].'<br>';
   echo '</p>';
} 
?>
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Post Reply