Link to home
Start Free TrialLog in
Avatar of Larry Vollmer
Larry Vollmer

asked on

Syntax question

I have the below chunk of code. I keep getting this error:

Parse error: syntax error, unexpected '{' in /Users/app/plugins/controllers/controller.php

which is this line:
else ($coupons_sent <= 5) {

I cannot figure out what the error is for the life of me. any ideas?

if ($coupons_sent >= 5) {
			
				$this->render('back');
				return;
			
			}

			else ($sent <= 5) {
			
				$fetch_ids = $this->Coupon->find('list', array(
					'fields' => array('Coupon.sender_person_id'),
					'Coupon.event_id' => $this->event_id,
					'Coupon.person_id' => $person_id
				)
			));
			

				$fetch_emails = $this->Coupon->find('list', array(
					'fields' => array('People.email'),
					'People.id' => $fetch_ids
				)
			));
			

				$this->Session->write('sender_emails', $fetch_emails);
				$this->render('success_no_5');
			}		
		}
		
		$this->_response['data']['coupons_sent'] = !empty($coupons_sent) ? $coupons_sent : 0;
		
		if (!empty($this->data)) {
				$this->render('forward');
				return;
		}
		
	}

Open in new window

Avatar of Jorge Paulino
Jorge Paulino
Flag of Portugal image

You have two curly brakets before this line when you only need one:

$this->_response['data']['coupons_sent'] = !empty($coupons_sent) ? $coupons_sent : 0;
ASKER CERTIFIED SOLUTION
Avatar of Michael701
Michael701
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Larry Vollmer
Larry Vollmer

ASKER

it's part of the code. i will try both solutions and report back thanks
else if was the problem thanks!