/    Sign up×
Community /Pin to ProfileBookmark

php coding error

could someone tell me what is wrong with my code? thank you

I type: php inphonic_script.php inphonic_ziplist_new.xls

I got the following error:

Parse error: parse error, unexpected ‘=’, expecting ‘)’ in /home/dhan/inphonic_script.php on line 10

Call Stack:

to post a comment
PHP

12 Comments(s)

Copy linkTweet thisAlerts:
@AdamGundryJan 19.2005 — Any chance of showing us the code of inphonic_script.php? A single "parse error" isn't really enough to identify the problem.

Adam
Copy linkTweet thisAlerts:
@handong888authorJan 19.2005 — <?

$db=MYSQL_CONNECT("db1","root");

MYSQL_SELECT_DB("theuseful",$db);

$file=$argv[1];

## ARRAY OF HOSTED OFFER ID



$priority=array(2=>"950",1=>"722",0="763");

$fp=fopen($file,"r");
if(empty($fp))
{
print("Cannot open $file");
exit;
}


while($zip = trim(fgets($fp,1000)))

{

$line=explode(",",$zip);

$count=count($priority);

for($x=0;$x<$count;$x++)
{
if($line[$x])
{
$final[$x]['list']=$final[$x]['list'] . "," . $line[$x];
}
}

}

# concatenate strings to create 'comparison' strings for array_diff()


foreach($priority as $key=>$value)

{

for($x=0;$x<$key;$x++)
{
$tempstring[$key]=$tempstring[$key] . $final[$x]['list'];
}

$finalarray[$key]=array_diff(explode(",",$final[$key]['list']),explode(",",$tempstring[$key]));

foreach($finalarray[$key] as $value2)
{
$query="insert into coreg_target (coreg_id,zip) VALUES ('$value','$value2')";
MYSQL_QUERY($query, $db);

#echo "$query n";

}

}

for($x=0;$x<count($priority);$x++)

{

$countx=count($finalarray[$x]);

echo "n $countx n";

}

?>
Copy linkTweet thisAlerts:
@NogDogJan 19.2005 — At line 10, or just as likely line 9 (and possibly a line or 2 above that), you probably have unbalanced parentheses (but possibly some other syntax error such as not terminating a command with a semi-colon). All the debugger really tells you is where it was in the source code when it got confused and gave up trying.
Copy linkTweet thisAlerts:
@NogDogJan 19.2005 — Probably this:

[FONT=courier new]$priority=array(2=>"950",1=>"722",0=[color=red]>[/color]"763");[/FONT]
Copy linkTweet thisAlerts:
@handong888authorJan 19.2005 — thanks a lot
Copy linkTweet thisAlerts:
@handong888authorJan 19.2005 — hi NotDog:

could you recommend some good debugger editor for programming in php? thank you very much
Copy linkTweet thisAlerts:
@NogDogJan 19.2005 — [i]Originally posted by handong888 [/i]

[B]hi NotDog:



could you recommend some good debugger editor for programming in php? thank you very much [/B][/QUOTE]
I use [url=http://www.chami.com/html-kit/]HTML-Kit[/url] which gives you color-coded syntax-highlighting and line numbers, plus there are a number of [url=http://www.chami.com/html%2Dkit/plugins/Dir/ServerSideScripting/PHP/]PHP-related plug-ins[/url] you might want to use.
Copy linkTweet thisAlerts:
@handong888authorJan 20.2005 — what is that PHP-related plug in for? thank you very much
Copy linkTweet thisAlerts:
@NogDogJan 20.2005 — [i]Originally posted by handong888 [/i]

[B]what is that PHP-related plug in for? thank you very much [/B][/QUOTE]

If you go to the provided link (http://www.chami.com/html%2Dkit/plugins/Dir/ServerSideScripting/PHP/) you'll see there are several available plug-ins with short descriptions of each. You can click on each for more info and decide which ones are of interest to you.
Copy linkTweet thisAlerts:
@handong888authorJan 20.2005 — Is HTML-KIT debugger for windows or linux?
Copy linkTweet thisAlerts:
@NogDogJan 20.2005 — [i]Originally posted by handong888 [/i]

[B]Is HTML-KIT debugger for windows or linux? [/B][/QUOTE]

HTML-Kit is a text editor. It's not a debugger, but it's color-coded syntax helps to see many simple errors. One of the plug-ins (which I've not tried), [url=http://www.chami.com/html%2Dkit/plugins/info/irdebugphp/]irDebugPHP[/url], "Adds a wizard for inserting PHP code snippets that can be used to debug PHP scripts."

HTML-Kit is a Windows application, though you can install and run it on Linux via the WINE interface.
Copy linkTweet thisAlerts:
@scragarJan 21.2005 — I don't have any instilation permisions at college so I tend to just use the forums php tags ([/code] to end and [code=php] to start) and this gives code highlighting making it easy to spot most parsing errors.
×

Success!

Help @handong888 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...