Operating System - Linux
1752755 Members
4946 Online
108789 Solutions
New Discussion юеВ

Problem with a php script.

 
SOLVED
Go to solution
Steven E. Protter
Exalted Contributor

Problem with a php script.

I know nothing about php, other than some very basic manipulation of other peoples code.

I have a php script that is malfunctioning and therefore keeping a website offline. The website was functioning but I discovered an error while creating the user guide and asked the developer to fix it.

He says he did, but I guess he didn't test it well. Now he's unavailable for a few days and I'd like to get the site back online.

The error from the error log of apache:

[client 82.81.181.6] PHP Parse error: parse error, unexpected '{' in /home/httpd/chicago50thward/htdocs/db_functions.php on line 385
[client 82.81.181.6] PHP Parse error: parse error, unexpected '{' in /home/httpd/chicago50thward/htdocs/db_functions.php on line 603

The code is attached.

The core functionality of the entire website is built into this module. At least thats what I believe.

Anyway I believe this is a simple syntax error and that someone might spot the code quickly.

I know the developer will eventually fix this, but I'm on an airplane in 54 hours and really hope I can fix this now.

TIA, 10 points for a fix that works. I will provide further information upon request.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
11 REPLIES 11
Geoff Wild
Honored Contributor

Re: Problem with a php script.

Took a quick look in Dreamweaver - doesn't look like any code errors - have to go now - if I get a chance I'll look tomorrow in more detail if this isn't solved.

Rgds...Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
Paul F. Carlson
Valued Contributor
Solution

Re: Problem with a php script.

It looks like you are missing a right paren ")" on line #384.

if (mysql_escape_string(strip_tags(trim($curr_ans)))

The "if" statement isn't being closed out.

And on line #602, there is no right paren ")" closing out the mysql_escape_string() call.

if (mysql_escape_string(strip_tags(trim($curr_status)) !
= "")

Paul
Link down -- cable problem?
Steven E. Protter
Exalted Contributor

Re: Problem with a php script.

I thought it was the parens but only tried to fix one. duh, maybe if I fixed both.

I'll give it a try on Tuesday, IST.

Please feel free to add new suggestions, there is always some reward for posting to my threads.

I'm sleepy and going to act on that situation befor trying to fix it.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Steven E. Protter
Exalted Contributor

Re: Problem with a php script.

New code:

384
if (mysql_escape_string(strip_tags(trim($curr_ans))))

602

if (mysql_escape_string(strip_tags(trim($curr_status)) != ""))

New log results:


[client 82.81.181.6] PHP Parse error: parse error, unexpected '{' in /home/httpd/chicago50thward/htdocs/db_functions.php on line 385
[Mon Feb 13 16:16:42 2006] [error] [client 82.81.181.6] File does not exist: /web/chicago50thward/htdocs/favicon.ico
[client 82.81.181.6] PHP Parse error: parse error, unexpected '{' in /home/httpd/chicago50thward/htdocs/db_functions.php on line 641

I corrected an error on line 640 and.....

WALA!

Site is working.

ITRC is best. A particularly busy ITRC member needs to buy me a beer next time I'm in Tel Aviv.

Thanks a lot. Points Inbound.

SEP


Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Steven E. Protter
Exalted Contributor

Re: Problem with a php script.

I need a primer in how to maintain this code.

Something I can print and read when I want to sleep on the plane.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Paul F. Carlson
Valued Contributor

Re: Problem with a php script.

I actually think that the documentation on php.net is pretty good. It's quite long though. You could just print out the first few sections, and get a taste for it.

Paul
Link down -- cable problem?
Steven E. Protter
Exalted Contributor

Re: Problem with a php script.

Another bunny to Paul, because solving my issue was very important.

I will read the site.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Arunvijai_4
Honored Contributor

Re: Problem with a php script.

Hi SEP,

When i was managing a PHP project, many develeopers in our team used only this guide,

http://us2.php.net/distributions/manual/php_manual_en.chm

PHP manual is the best thing to start with.

http://us3.php.net/manual/en/

-Arun
"A ship in the harbor is safe, but that is not what ships are built for"
Muthukumar_5
Honored Contributor

Re: Problem with a php script.

SEP,

If you are having php manual then php is nothing. Hope you are great in html, perl and c. Then it is simple.

http://www.php.net/download-docs.php

Download manual to your desktop and use whenever you are getting problem with php. And more php list is veryyyy active.

--
Muthu
Easy to suggest when don't know about the problem!