homepage Welcome to WebmasterWorld Guest from 54.205.241.107
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
parse error, unexpected T_STRING
What on earth is wrong
neiljones

10+ Year Member



 
Msg#: 1896 posted 11:19 pm on Oct 19, 2003 (gmt 0)

I'm fairly new to PHP. I have been puzzling for hours over this;_

I'm getting
Parse error: parse error, unexpected T_STRING, expecting '(' in /usr/www/users/wildsite/ecodating/datread3.php on line 13

Here is the program Any ideas why it does not work?

<html>
<head>
<title> results </title>
<body>
<?php
$filename ="findata.txt";
$myFile = fopen($filename, "r");
$fcontents = file($filename);
while (list ($line_num, $line) = each ($fcontents))
{
echo $line."<br>\n";
$pattern ="/END0/";
if preg_match ("/END0/",$line)
{
echo "DO work":
}

}
fclose($myFile);
?>
</body>
</html>

 

MonkeeSage

WebmasterWorld Senior Member 10+ Year Member



 
Msg#: 1896 posted 11:36 pm on Oct 19, 2003 (gmt 0)

If that's your whole file then the problem is on the if preg_match line (which is what I was thinking anyhow) -- try single quoting the pattern or escaping the pound sign, it is probably having trouble parsing it, so it thinks there isn't a closing quote and thus thinks there isn't a closing parenthesis...that would be my best guess.

Jordan

keeper

10+ Year Member



 
Msg#: 1896 posted 12:05 am on Oct 20, 2003 (gmt 0)

You also have a colon instead of a semi-colon at the end of your echo "Do Work" statement.

Chroder

10+ Year Member



 
Msg#: 1896 posted 12:40 am on Oct 20, 2003 (gmt 0)

Try

if(preg_match("/END0/",$line))

in place of your current if. (along with fixint what keeper said) :)

MonkeeSage

WebmasterWorld Senior Member 10+ Year Member



 
Msg#: 1896 posted 2:49 am on Oct 20, 2003 (gmt 0)

Good call Chroder. :)

Jordan

neiljones

10+ Year Member



 
Msg#: 1896 posted 7:18 pm on Oct 22, 2003 (gmt 0)

Duh! Of course. Thanks everybody. It is obvious when you see it. It have been programing in too many different languages recently.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved