Little php code - error
am 08.04.2010 16:21:12 von juan
Hi guys,
I'm having trouble with the following little php code [0]. The output
from the server is : "
* Parse error: syntax error, unexpected '{' in file.php on line 27 *
Let's assume that file.php is the file that is giving me some troubles.
The structure is pretty easy to understand, however I'm not able to
solve this. Could you tell me why I'm not able to run this code.
I'm running PHP5, Apache2, and Ubuntu 9.10 with sqlite, as you could see.
Thanks a lot,
Juan
[0] http://pastebin.com/xC4pFbfH
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: Little php code - error
am 08.04.2010 16:23:17 von Devendra Jadhav
--e0cb4e887cab83bc390483ba6b7f
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
Can you paste your code somewhere?
On Thu, Apr 8, 2010 at 7:51 PM, Juan wrote:
> Hi guys,
> I'm having trouble with the following little php code [0]. The output
> from the server is : "
> * Parse error: syntax error, unexpected '{' in file.php on line 27 *
>
> Let's assume that file.php is the file that is giving me some troubles.
>
> The structure is pretty easy to understand, however I'm not able to
> solve this. Could you tell me why I'm not able to run this code.
>
> I'm running PHP5, Apache2, and Ubuntu 9.10 with sqlite, as you could see.
>
> Thanks a lot,
> Juan
>
> [0] http://pastebin.com/xC4pFbfH
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--=20
Devendra Jadhav
दà¥à¤µà¥à¤à¤¦à¥ र =
à¤à¤¾à¤§à¤µ
--e0cb4e887cab83bc390483ba6b7f--
Re: Little php code - error
am 08.04.2010 16:26:16 von Dan Joseph
--0016367f96762437280483ba7648
Content-Type: text/plain; charset=ISO-8859-1
On Thu, Apr 8, 2010 at 10:21 AM, Juan wrote:
> Hi guys,
> I'm having trouble with the following little php code [0]. The output
> from the server is : "
> * Parse error: syntax error, unexpected '{' in file.php on line 27 *
>
> Let's assume that file.php is the file that is giving me some troubles.
>
> The structure is pretty easy to understand, however I'm not able to
> solve this. Could you tell me why I'm not able to run this code.
>
> I'm running PHP5, Apache2, and Ubuntu 9.10 with sqlite, as you could see.
>
>
Its your if's, elseif's, else's. You have "and", change that to &&.
--
-Dan Joseph
www.canishosting.com - Unlimited Hosting Plans start @ $3.95/month. Promo
Code "NEWTHINGS" for 10% off initial order
http://www.facebook.com/canishosting
http://www.facebook.com/originalpoetry
--0016367f96762437280483ba7648--
Re: Little php code - error
am 08.04.2010 16:30:00 von Dan Joseph
--0016367f96767ea2470483ba83c9
Content-Type: text/plain; charset=ISO-8859-1
On Thu, Apr 8, 2010 at 10:21 AM, Juan wrote:
> Hi guys,
> I'm having trouble with the following little php code [0]. The output
> from the server is : "
> * Parse error: syntax error, unexpected '{' in file.php on line 27 *
>
Sorry, I gave you bad information...
Its the else line. else doesn't take a condition after it. it should just
be "else {".
--
-Dan Joseph
www.canishosting.com - Unlimited Hosting Plans start @ $3.95/month. Promo
Code "NEWTHINGS" for 10% off initial order
http://www.facebook.com/canishosting
http://www.facebook.com/originalpoetry
--0016367f96767ea2470483ba83c9--
Re: Little php code - error
am 08.04.2010 16:30:12 von David Otton
On 8 April 2010 15:21, Juan wrote:
> The structure is pretty easy to understand, however I'm not able to
> solve this. Could you tell me why I'm not able to run this code.
Your else has a condition on it
} else (empty($b) and empty($c)) {
Should be
} else {
BTW, the "and" is fine.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: Little php code - error
am 08.04.2010 16:34:50 von Peter Lind
On 8 April 2010 16:30, David Otton wrote:
> On 8 April 2010 15:21, Juan wrote:
>
>> The structure is pretty easy to understand, however I'm not able to
>> solve this. Could you tell me why I'm not able to run this code.
>
> Your else has a condition on it
>
> } else (empty($b) and empty($c)) {
>
> Should be
>
> } else {
Unless he actually wants to do something with that condition, in which
case it should be an elseif.
> BTW, the "and" is fine.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
WWW: http://plphp.dk / http://plind.dk
LinkedIn: http://www.linkedin.com/in/plind
Flickr: http://www.flickr.com/photos/fake51
BeWelcome: Fake51
Couchsurfing: Fake51
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: Little php code - error
am 08.04.2010 16:41:20 von Richard Quadling
On 8 April 2010 15:21, Juan wrote:
> Hi guys,
> I'm having trouble with the following little php code [0]. The output
> from the server is : "
> * Parse error: syntax error, unexpected '{' in file.php on line 27 *
>
> Let's assume that file.php is the file that is giving me some troubles.
>
> The structure is pretty easy to understand, however I'm not able to
> solve this. Could you tell me why I'm not able to run this code.
>
> I'm running PHP5, Apache2, and Ubuntu 9.10 with sqlite, as you could see.
>
> Thanks a lot,
> Juan
>
> [0] http://pastebin.com/xC4pFbfH
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
http://pastebin.com/diff.php?i=2QbANWnS
--
-----
Richard Quadling
"Standing on the shoulders of some very clever giants!"
EE : http://www.experts-exchange.com/M_248814.html
EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: Little php code - error
am 08.04.2010 16:47:10 von Richard Quadling
On 8 April 2010 15:21, Juan wrote:
> Hi guys,
> I'm having trouble with the following little php code [0]. The output
> from the server is : "
> * Parse error: syntax error, unexpected '{' in file.php on line 27 *
>
> Let's assume that file.php is the file that is giving me some troubles.
>
> The structure is pretty easy to understand, however I'm not able to
> solve this. Could you tell me why I'm not able to run this code.
>
> I'm running PHP5, Apache2, and Ubuntu 9.10 with sqlite, as you could see.
>
> Thanks a lot,
> Juan
>
> [0] http://pastebin.com/xC4pFbfH
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
http://pastebin.com/sUf2pxnW
--
-----
Richard Quadling
"Standing on the shoulders of some very clever giants!"
EE : http://www.experts-exchange.com/M_248814.html
EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: Little php code - error
am 08.04.2010 17:17:42 von juan
2010/4/8 Richard Quadling :
> On 8 April 2010 15:21, Juan wrote:
>> Hi guys,
>> I'm having trouble with the following little php code [0]. The output
>> from the server is : "
>> * Parse error: syntax error, unexpected '{' in file.php on line 27 *
>>
>> Let's assume that file.php is the file that is giving me some troubles.
>>
>> The structure is pretty easy to understand, however I'm not able to
>> solve this. Could you tell me why I'm not able to run this code.
>>
>> I'm running PHP5, Apache2, and Ubuntu 9.10 with sqlite, as you could see.
>>
>> Thanks a lot,
>> Juan
>>
>> [0] http://pastebin.com/xC4pFbfH
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>
> http://pastebin.com/diff.php?i=2QbANWnS
Thanks a lot people!.
It's solved.
Juan
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: Little php code - error
am 08.04.2010 17:26:08 von Ashley Sheridan
--=-EqnmWHgjcTTh8WH1Xjn5
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
On Thu, 2010-04-08 at 12:17 -0300, Juan wrote:
> 2010/4/8 Richard Quadling :
> > On 8 April 2010 15:21, Juan wrote:
> >> Hi guys,
> >> I'm having trouble with the following little php code [0]. The output
> >> from the server is : "
> >> * Parse error: syntax error, unexpected '{' in file.php on line 27 *
> >>
> >> Let's assume that file.php is the file that is giving me some troubles.
> >>
> >> The structure is pretty easy to understand, however I'm not able to
> >> solve this. Could you tell me why I'm not able to run this code.
> >>
> >> I'm running PHP5, Apache2, and Ubuntu 9.10 with sqlite, as you could see.
> >>
> >> Thanks a lot,
> >> Juan
> >>
> >> [0] http://pastebin.com/xC4pFbfH
> >>
> >> --
> >> PHP General Mailing List (http://www.php.net/)
> >> To unsubscribe, visit: http://www.php.net/unsub.php
> >>
> >>
> >
> > http://pastebin.com/diff.php?i=2QbANWnS
>
> Thanks a lot people!.
>
> It's solved.
>
> Juan
>
The easiest way to spot these sorts of problems is by indenting the code
so that the opening brace matches up with the closing one:
function
{
if(condition)
{
statement
}
else
{
foreach(var as var2)
{
more statements
}
}
}
Yes, it takes up a lot more lines, but a few line break characters
aren't going to impact on the size of the file, and all the while it's
very easy to read. If you've accidentally missed out a closing brace
you'll spot it immediately.
It's called the Allman style and has another advantage. Consider:
if(condition)
{
statement
}
You can comment out the if statement and the braces won't cause an
error:
//if(condition)
{
statement
}
Whereas doing the same with the BSD KNF style that many favour you would
hit a problem of mismatched braces:
//if(condition){
statement
}
Thanks,
Ash
http://www.ashleysheridan.co.uk
--=-EqnmWHgjcTTh8WH1Xjn5--
Re: Little php code - error
am 08.04.2010 17:57:18 von Ashley Sheridan
--=-6hbefWTA9benRyTI13wP
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
On Thu, 2010-04-08 at 12:00 -0400, Paul M Foster wrote:
> On Thu, Apr 08, 2010 at 04:26:08PM +0100, Ashley Sheridan wrote:
>
> > On Thu, 2010-04-08 at 12:17 -0300, Juan wrote:
> >
> > > 2010/4/8 Richard Quadling :
> > > > On 8 April 2010 15:21, Juan wrote:
> > > >> Hi guys,
> > > >> I'm having trouble with the following little php code [0]. The output
> > > >> from the server is : "
> > > >> * Parse error: syntax error, unexpected '{' in file.php on line 27 *
> > > >>
> > > >> Let's assume that file.php is the file that is giving me some troubles.
> > > >>
> > > >> The structure is pretty easy to understand, however I'm not able to
> > > >> solve this. Could you tell me why I'm not able to run this code.
> > > >>
> > > >> I'm running PHP5, Apache2, and Ubuntu 9.10 with sqlite, as you
> > could see.
> > > >>
> > > >> Thanks a lot,
> > > >> Juan
> > > >>
> > > >> [0] http://pastebin.com/xC4pFbfH
> > > >>
> > > >> --
> > > >> PHP General Mailing List (http://www.php.net/)
> > > >> To unsubscribe, visit: http://www.php.net/unsub.php
> > > >>
> > > >>
> > > >
> > > > http://pastebin.com/diff.php?i=2QbANWnS
> > >
> > > Thanks a lot people!.
> > >
> > > It's solved.
> > >
> > > Juan
> > >
> >
> >
> > The easiest way to spot these sorts of problems is by indenting the code
> > so that the opening brace matches up with the closing one:
> >
> > function
> > {
> > if(condition)
> > {
> > statement
> > }
> > else
> > {
> > foreach(var as var2)
> > {
> > more statements
> > }
> > }
> > }
> >
> > Yes, it takes up a lot more lines, but a few line break characters
> > aren't going to impact on the size of the file, and all the while it's
> > very easy to read. If you've accidentally missed out a closing brace
> > you'll spot it immediately.
> >
> > It's called the Allman style and has another advantage. Consider:
>
> While we all love Ash, he is a blasphemer, as he argues against the One
> True Style, which is K&R. (Please forgive him, Lords Kernighan and
> Richie). ;-}
>
> In the OP's case, his error was syntax (a condition after an else
> clause). But I don't know that even a syntax-highlighting editor would
> have caught his error.
>
> Paul
>
> --
> Paul M. Foster
>
Blaspheme is a little strong :p
Thanks,
Ash
http://www.ashleysheridan.co.uk
--=-6hbefWTA9benRyTI13wP--
Re: Little php code - error
am 08.04.2010 18:00:56 von Paul M Foster
On Thu, Apr 08, 2010 at 04:26:08PM +0100, Ashley Sheridan wrote:
> On Thu, 2010-04-08 at 12:17 -0300, Juan wrote:
>
> > 2010/4/8 Richard Quadling :
> > > On 8 April 2010 15:21, Juan wrote:
> > >> Hi guys,
> > >> I'm having trouble with the following little php code [0]. The output
> > >> from the server is : "
> > >> * Parse error: syntax error, unexpected '{' in file.php on line 27 *
> > >>
> > >> Let's assume that file.php is the file that is giving me some troubles.
> > >>
> > >> The structure is pretty easy to understand, however I'm not able to
> > >> solve this. Could you tell me why I'm not able to run this code.
> > >>
> > >> I'm running PHP5, Apache2, and Ubuntu 9.10 with sqlite, as you
> could see.
> > >>
> > >> Thanks a lot,
> > >> Juan
> > >>
> > >> [0] http://pastebin.com/xC4pFbfH
> > >>
> > >> --
> > >> PHP General Mailing List (http://www.php.net/)
> > >> To unsubscribe, visit: http://www.php.net/unsub.php
> > >>
> > >>
> > >
> > > http://pastebin.com/diff.php?i=2QbANWnS
> >
> > Thanks a lot people!.
> >
> > It's solved.
> >
> > Juan
> >
>
>
> The easiest way to spot these sorts of problems is by indenting the code
> so that the opening brace matches up with the closing one:
>
> function
> {
> if(condition)
> {
> statement
> }
> else
> {
> foreach(var as var2)
> {
> more statements
> }
> }
> }
>
> Yes, it takes up a lot more lines, but a few line break characters
> aren't going to impact on the size of the file, and all the while it's
> very easy to read. If you've accidentally missed out a closing brace
> you'll spot it immediately.
>
> It's called the Allman style and has another advantage. Consider:
While we all love Ash, he is a blasphemer, as he argues against the One
True Style, which is K&R. (Please forgive him, Lords Kernighan and
Richie). ;-}
In the OP's case, his error was syntax (a condition after an else
clause). But I don't know that even a syntax-highlighting editor would
have caught his error.
Paul
--
Paul M. Foster
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: Little php code - error
am 08.04.2010 20:25:27 von List Manager
Paul M Foster wrote:
> On Thu, Apr 08, 2010 at 04:26:08PM +0100, Ashley Sheridan wrote:
>
>> On Thu, 2010-04-08 at 12:17 -0300, Juan wrote:
>>
>>> 2010/4/8 Richard Quadling :
>>>> On 8 April 2010 15:21, Juan wrote:
>>>>> Hi guys,
>>>>> I'm having trouble with the following little php code [0]. The output
>>>>> from the server is : "
>>>>> * Parse error: syntax error, unexpected '{' in file.php on line 27 *
>>>>>
>>>>> Let's assume that file.php is the file that is giving me some troubles.
>>>>>
>>>>> The structure is pretty easy to understand, however I'm not able to
>>>>> solve this. Could you tell me why I'm not able to run this code.
>>>>>
>>>>> I'm running PHP5, Apache2, and Ubuntu 9.10 with sqlite, as you
>> could see.
>>>>> Thanks a lot,
>>>>> Juan
>>>>>
>>>>> [0] http://pastebin.com/xC4pFbfH
>>>>>
>>>>> --
>>>>> PHP General Mailing List (http://www.php.net/)
>>>>> To unsubscribe, visit: http://www.php.net/unsub.php
>>>>>
>>>>>
>>>> http://pastebin.com/diff.php?i=2QbANWnS
>>> Thanks a lot people!.
>>>
>>> It's solved.
>>>
>>> Juan
>>>
>>
>> The easiest way to spot these sorts of problems is by indenting the code
>> so that the opening brace matches up with the closing one:
>>
>> function
>> {
>> if(condition)
>> {
>> statement
>> }
>> else
>> {
>> foreach(var as var2)
>> {
>> more statements
>> }
>> }
>> }
>>
>> Yes, it takes up a lot more lines, but a few line break characters
>> aren't going to impact on the size of the file, and all the while it's
>> very easy to read. If you've accidentally missed out a closing brace
>> you'll spot it immediately.
>>
>> It's called the Allman style and has another advantage. Consider:
>
> While we all love Ash, he is a blasphemer, as he argues against the One
> True Style, which is K&R. (Please forgive him, Lords Kernighan and
> Richie). ;-}
>
> In the OP's case, his error was syntax (a condition after an else
> clause). But I don't know that even a syntax-highlighting editor would
> have caught his error.
>
> Paul
>
The syntax highlighters that I use didn't recognize it as a problem. They
styled it right up...
--
Jim Lucas
NOC Manager
541-323-9113
BendTel, Inc.
http://www.bendtel.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php