PHP error

I am getting a PHP error:Parse error: syntax error, unexpected T_VARIABLE
It says it's at line number: 45
I can't figure it out.
<?php
	$this->EE->db->select('*')
 					->where('order_id', $entry_id)
					->where('entry_id', '29')
					->limit('1');

		$order_query = $this->EE->db->get('cartthrob_order_items');
		$this->_policy  = $entry_id; 

		$order_items = $order_query->result_array();

		$order_query->free_result();

		$keep_extra = FALSE;

		$this->_uuid_cancel = $this->generate_uuid();
		
 		foreach ($order_items as $row)
		{
			$extra = _unserialize($row['extra'], TRUE);

			if ($keep_extra)
			{
				$row['extra'] = $extra;
			}
			else
			{
				foreach ($extra as $key => $value)
			{
					if ( ! isset($row[$key]))
					{
						$row[$key] = $value;
 					}
				}
 				unset($row['extra']);
			}
			break; // only need this one time. 
		}		
		if (isset($row))
		{
		$policy_number = $row['policy_number'];
		$sd = date('Y-m-d', $row['entry_date']);
		
		$cancel_xml = "<PolicyPartialImageCancelRq>";
  			$cancel_xml.= "<RqUID>".$this->_uuid_cancel."</RqUID>";
  			$cancel_xml.= "<TransactionRequestDt>".date('Y-m-d')."</TransactionRequestDt>";
  			$cancel_xml.= "<TransactionEffectiveDt>2015-04-08</TransactionEffectiveDt>";
  			$cancel_xml.= "<TransactionIdentifier>2</TransactionIdentifier>";
 			 $cancel_xml.= "<PolicyCancelNonRenew>";
    			$cancel_xml.= "<PartialPolicy>";
      			$cancel_xml.= "<PolicyNumber>".$policy_number."</PolicyNumber>";
      			$cancel_xml.= "<LOBCd />";
      			$cancel_xml.= "<ContractTerm>";
        			$cancel_xml.= "<EffectiveDt>".$sd."</EffectiveDt>";
      			$cancel_xml.= "</ContractTerm>";
    			$cancel_xml.= "</PartialPolicy>";
    			$cancel_xml.= "<CancelNonRenewInfo>";
      			$cancel_xml.= "<BusinessPurposeTypeCd>XLN</BusinessPurposeTypeCd>";
      			$cancel_xml.= "<RequestorCd>".$cancel_request."</RequestorCd>";
      			$cancel_xml.= "<CancelReasonCd>".ee()->session->userdata('refund_reason')."</CancelReasonCd>";
      			$cancel_xml.= "<CancellationTypeCd>".$cancel_type."</CancellationTypeCd>";
    			$cancel_xml.= "</CancelNonRenewInfo>";
  			$cancel_xml.= "</PolicyCancelNonRenew>";
		$cancel_xml.= "</PolicyPartialImageCancelRq>";
		
		}  //  END Row	

Open in new window

LVL 8
rgranlundAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Marco GasiFreelancerCommented:
Don't think this matter, but do you know that if you're using double quotes you can insert php variables within the strings?

$cancel_xml.= "<RqUID>$this->_uuid_cancel</RqUID>";

Open in new window


For the rest I don't see anything in your code which can explain the issue...
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
gr8gonzoConsultantCommented:
What's the full error message? Are you sure it's in this particular file and not an included file?
0
rgranlundAuthor Commented:
It's not an include file.  The error specifically mentions that line.

Parse error: syntax error, unexpected T_VARIABLE
0
Learn Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

gr8gonzoConsultantCommented:
Right, but what is the full error with the line number and everything? Also, the code you posted must be an included or a required file or else you left out some code. Otherwise, $this would not be defined at the very top.

The code you posted just doesn't really have an error on that line.

Usually, that error means that you've got a missing semicolon or a missing quote mark somewhere above the line, but I don't see anything wrong in the code you posted.
0
rgranlundAuthor Commented:
Here is the entire thing.  It errors at line number: 75
"Parse error: syntax error, unexpected T_VARIABLE"
	public function cancel($transaction_id, $entry_id) {
		
	$this->EE->load->model('order_model');

		$order = $this->EE->order_model->get_order_from_entry($entry_id);

		$this->_user = $this->plugin_settings('username'); 
		$this->_pass = $this->plugin_settings('password');

 		$this->_uuid = $this->generate_uuid();
		
		$refund_reason = ee()->session->userdata('refund_reason');
		
		if(isset($refund_reason) && $refund_reason == "C2") {
			$cancel_type = "FL";
			$cancel_request = "C";
		} elseif (isset($refund_reason) && $refund_reason == "C3") {
			$cancel_type = "FL";
			$cancel_request = "C";
		} elseif (isset($refund_reason) && $refund_reason == "C4") {
			$cancel_type = "PR";
			$cancel_request = "I";
		} elseif (isset($refund_reason) && $refund_reason == "C7") {
			$cancel_type = "SR";
			$cancel_request = "I";
		}  else {
			$cancel_type = "PR";
			$cancel_request = "C";
		}
		

		$this->EE->db->select('*')
 					->where('order_id', $entry_id)
					->where('entry_id', '29')
					->limit('1');

		$order_query = $this->EE->db->get('cartthrob_order_items');
		$this->_policy  = $entry_id; 

		$order_items = $order_query->result_array();

		$order_query->free_result();

		$keep_extra = FALSE;

		$this->_uuid_cancel = $this->generate_uuid();
		
 		foreach ($order_items as $row)
		{
			$extra = _unserialize($row['extra'], TRUE);

			if ($keep_extra)
			{
				$row['extra'] = $extra;
			}
			else
			{
				foreach ($extra as $key => $value)
			{
					if ( ! isset($row[$key]))
					{
						$row[$key] = $value;
 					}
				}
 				unset($row['extra']);
			}
			break; // only need this one time. 
		}		
		if (isset($row))
		{
		$policy_number = $row['policy_number'];
		$sd = date('Y-m-d', $row['entry_date']);
		
		$cancel_xml = "<PolicyPartialImageCancelRq>";
  			$cancel_xml .= "<RqUID>".$this->_uuid_cancel."</RqUID>";
  			$cancel_xml .= "<TransactionRequestDt>".date('Y-m-d')."</TransactionRequestDt>";
  			$cancel_xml .= "<TransactionEffectiveDt>2015-04-08</TransactionEffectiveDt>";
  			$cancel_xml .= "<TransactionIdentifier>2</TransactionIdentifier>";
 			 $cancel_xml .= "<PolicyCancelNonRenew>";
    			$cancel_xml .= "<PartialPolicy>";
      			$cancel_xml .= "<PolicyNumber>".$policy_number."</PolicyNumber>";
      			$cancel_xml .= "<LOBCd />";
      			$cancel_xml .= "<ContractTerm>";
        			$cancel_xml .= "<EffectiveDt>".$sd."</EffectiveDt>";
      			$cancel_xml .= "</ContractTerm>";
    			$cancel_xml .= "</PartialPolicy>";
    			$cancel_xml .= "<CancelNonRenewInfo>";
      			$cancel_xml .= "<BusinessPurposeTypeCd>XLN</BusinessPurposeTypeCd>";
      			$cancel_xml .= "<RequestorCd>".$cancel_request."</RequestorCd>";
      			$cancel_xml .= "<CancelReasonCd>".ee()->session->userdata('refund_reason')."</CancelReasonCd>";
      			$cancel_xml .= "<CancellationTypeCd>".$cancel_type."</CancellationTypeCd>";
    			$cancel_xml .= "</CancelNonRenewInfo>";
  			$cancel_xml .= "</PolicyCancelNonRenew>";
		$cancel_xml .= "</PolicyPartialImageCancelRq>";
		
		}  //  END Row	
		

Open in new window

0
rgranlundAuthor Commented:
There was a weird tab issue.  I fixed it.  Thanks for your help and suggestions.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.