PHP-MySQL coding

  • Thread starter Thread starter Anonymous
  • Start date Start date
A

Anonymous

Guest
Can you solve the problem for this error?
Code:
<?php 
//base_class.php
class Base 
{ 
	function sql_format ($field) 
	{ 
		if (empty($this->$field)) 
		{ 
			return "null"; 
		} 
		elseif (is_numeric($this->$field)) 
		{ 
			return $this->$field; 
		} 
		else 
		{ 
			return "'".$this->$field."'"; 
		} 
	} 
	function set_image_src ($file_src="") 
	{ 
		if (!empty($this->imagefile) && $this->imagefile != "none") 
		{ 
			if ($file_src === "") 
			{ 
				$file_src = "images/".uniqid("image_"); 
			} 
			umask(2); 
			$sizearr = GetImageSize($this->imagefile); 
			if ($sizearr[2] == 1) 
			{ 
				$file_ext = ".gif"; 
			} 
			elseif ($sizearr[2] == 2) 
			{ 
				$file_ext = ".jpg"; 
			} 
			elseif ($sizearr[2] == 3) 
			{ 
				$file_ext = ".png"; 
			} 
			else 
			{ 
				$file_ext = strtolower(substr($this->imagefile_name, strrpos($this->imagefile_name,"."))); 
			} 
			$thumb_src = $file_src."_thumb".$file_ext; 
			$file_src .= $file_ext; 
			copy($this->imagefile, $file_src); 
			if ($file_ext == ".jpg") 
			{ 
				$cmd = "../catalog/makeimagethumb $file_src $thumb_src $this->thumb_width"; 
				$out = system($cmd,$err); 
				if ($err) 
				{ 
					print "<h4><li>cmd=$cmd <li>err=$err<li>out=$out</h4>\n"; 
				} 
				else 
				{ 
					copy($file_src, $thumb_src); 
				} 
				$this->image_src = $file_src; 
				$this->thumb_src = $thumb_src; 
			} 
			else 
			{ 
				$this->set_thumb_src(); 
			} 
		} 
	} 
	function set_thumb_src() 
	{ 
		$last_period = strrpos($this->image_src,"."); 
		if ($last_period === false) 
		{ 
			$this->thumb_src = $this->image_src."_thumb"; 
		} 
		else 
		{ 
			$this->thumb_src = substr_replace($this->image_src, "_thumb.", $last_period, 1); 
		} 
	} 
	function Base ($parent="",$atts="") 
	{ 
		$this->Construct(get_object_vars($parent)); 
		$this->Construct($atts); 
	} 
	function confirm_delete_form($message="", $label="") 
	{ 
		$warning = "<b>Please confirm your delete request</b>"; 
		if (!empty($message)) 
		{ 
			$warning .= "- $message"; 
		} 
		$output = <<<EOQ 
		<p> 
		<form method="post"> 
		$warning 
		<input type="hidden" name="confirm" value="Confirm Delete"> 
		<input type="submit" name="submit" value="$label"> 
		</form> 
		</p> 
		EOQ; 
		return $output; 
	} 
	function Construct ($atts="") 
	{ 
		if (is_array($atts)) 
		{ 
			while (list($name,$value) = each($atts)) 
			{ 
				if (!empty($value) && !is_array($value)) 
				{ 
					$this->$name = $value; 
				} 
			} 
		} 
		if (!empty($this->image_src)) 
		{ 
			$this->set_thumb_src(); 
		} 
	} 
	function Base ($parent="",$atts="") 
	{ 
		$this->thumb_width = 50; 
		if (is_object($parent)) 
		{ 
			$this->Construct(get_object_vars($parent)); 
		} 
		$this->Construct($atts); 
	} 
} 
?>
Parse error: parse error, unexpected T_SL in D:\Program Files\Apache Group\Apache2\htdocs\edwinlamchouyin\test\catalog\base_class.php on line 93
 
I am unfamiliar with this <<<EOQ syntax. Are you wanting to put everything after the $output= into the output string?

$output = <<<EOQ
<p>
<form method="post">
$warning
<input type="hidden" name="confirm" value="Confirm Delete">
<input type="submit" name="submit" value="$label">
</form>
</p>
EOQ;
 
Back
Top