syntax error: unexpected T_BOOLEAN_AND...

This is a discussion on "syntax error: unexpected T_BOOLEAN_AND..." within the PHP Forum section. This forum, and the thread "syntax error: unexpected T_BOOLEAN_AND... are both part of the Program Your Website category.



Go Back   Webforumz.com > Main Forums > Program Your Website > PHP Forum

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Jan 23rd, 2006, 13:47
Junior Member
Join Date: Sep 2005
Location: kNot in Kansas
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
syntax error: unexpected T_BOOLEAN_AND...

i'm receiving the error unexpected T_BOOLEAN_OR for the following line of code:
PHP: Select all

if (($_POST['title']) == '') || (($_POST['desc'])=='') || (($_POST['state'])=='') || (($_POST['date']) == '') { 

considering that so far i've made several fairly complex little apps using similar lines of code-- i simply can not see what is wrong here. does this mean that the error in this case must be conditional based on the context in which this line appears?

i thought it might have something to do w/ single vs double quoted strings, but this line produces the same error:
PHP: Select all

if (($_POST['title']) == "") || (($_POST['desc'])=="") || (($_POST['state'])=="") || (($_POST['date']) == "") { 

signed:
Stumped in the Valley

(PS: ya know, i avoided posting this question because i think it seems so "obvious"... ugh!)
Reply With Quote

  #2 (permalink)  
Old Jan 24th, 2006, 19:28
benbacardi's Avatar
Highly Reputable Member
Join Date: Feb 2004
Location: United Kingdom
Age: 20
Posts: 611
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to benbacardi Send a message via Skype™ to benbacardi
Re: syntax error: unexpected T_BOOLEAN_AND...

try using this code instead:

PHP: Select all

if ((($_POST['title']) == '') || (($_POST['desc'])=='') || (($_POST['state'])=='') || (($_POST['date']) == '')) { 

you may need to encase the whole of the if statement conditions within one large ( ) which is what i've added above...
Reply With Quote
  #3 (permalink)  
Old Jan 24th, 2006, 21:45
Junior Member
Join Date: Jan 2006
Age: 25
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
Re: syntax error: unexpected T_BOOLEAN_AND...

Off the top of my head it looks to me like you missed a ) at the end
(($_POST['date']) == '') {
Should be
(($_POST['date']) == '')) {
Reply With Quote
  #4 (permalink)  
Old Jan 25th, 2006, 11:24
benbacardi's Avatar
Highly Reputable Member
Join Date: Feb 2004
Location: United Kingdom
Age: 20
Posts: 611
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to benbacardi Send a message via Skype™ to benbacardi
Re: syntax error: unexpected T_BOOLEAN_AND...

he didnt miss one out at the end, because he didnt put one in at the beginning! you need to add one 2 the beginning AND the end, which is what i did in the code above...
Reply With Quote
  #5 (permalink)  
Old Jan 28th, 2006, 07:29
Reputable Member
Join Date: Sep 2005
Location: Canada, BC
Age: 24
Posts: 239
Thanks: 0
Thanked 0 Times in 0 Posts
Re: syntax error: unexpected T_BOOLEAN_AND...

Benbacardi's method would solve the issue, however to be much more easly read, I would write it like this
PHP: Select all

if ($_POST['title'] == '' || $_POST['desc']=='' || $_POST['state']=='' || $_POST['date'] == '') { 

This should have the exact same result, (I'm pretty sure it should, but once in a while I miss the obvious.

Further more, I would do this
PHP: Select all

if (empty($_POST['title']) || empty($_POST['desc']) || empty($_POST['state']) || empty($_POST['date']) ) { 


Last edited by Pheonix; Jan 28th, 2006 at 07:32.
Reply With Quote
Reply

Tags
syntax, error, unexpected, t_boolean_and

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] parse error, unexpected T_EXIT in php mail script Posie PHP Forum 8 Dec 13th, 2007 14:21
[SOLVED] error in SQL syntax but where it all looks fine to me Andrew1986 Databases 3 Nov 28th, 2007 01:21
syntax error... ktsirig Databases 2 Feb 4th, 2007 14:48
Annoying little syntax error adeking Web Page Design 4 Aug 9th, 2006 13:50
error in SQL syntax Drgreenfingers Databases 10 Jan 30th, 2006 02:00


All times are GMT. The time now is 05:49.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43