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 7
rgranlundAsked:
Who is Participating?
 
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
 
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
Cloud Class® Course: Microsoft Office 2010

This course will introduce you to the interfaces and features of Microsoft Office 2010 Word, Excel, PowerPoint, Outlook, and Access. You will learn about the features that are shared between all products in the Office suite, as well as the new features that are product specific.

 
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.