Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PHPEDIT PROGRAM

Status
Not open for further replies.

ironfoot495

Technical User
May 24, 2006
3
US
I'm having a lot of trouble working on Os windows XP.Idownloaded the phpedit program and using the book PHP COOKBOOK, written by David Sklar and Adam Trachtenburg. Every time I put in some of the code in this book I get an Parsinjg error message.

<php Code </>

<HTML>
<HEAD>
<TITLE> Parsing Fixed-Width Delimited Data</TITLE>
</HEAD>
<BODY>
<?php
$fp = fopen('fixed-width-records.txt','r') or die ("can't open file);
while ($s = fgets($fp,1024)) {
$fields[1] = substr($s,0,10); // first field: first 10 characters of the line
$fields[2] = substr($s,10,5); // second field: next 5 characters of the line
$fields[3] = substr($s,0,10); // third field: next 12 characters of the line
}
$ft = fclose($fp) or die("can't close the file");
// a function to do something with the fields
// process_fields($fields);
// You need to break apart fixed-width records in strings


?>
</BODY>
</HTML>

I really don't understand why I keep getting a parsing error, can someone tell me what's going on.
 
parsing error" is vague. I know the PHP parser gave you something more specific. Would you share the exact error message, please?



Want the best answers? Ask the best questions! TANSTAAFL!
 
But just from looking at it, this line:

$fp = fopen('fixed-width-records.txt','r') or die ("can't open file);

is missing a close doublequote at the end of [tt]...open file[/tt]



Want the best answers? Ask the best questions! TANSTAAFL!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top