Jump to content

using mysql_real_escape_string error


Yohanne

Recommended Posts

hi all,

 

why i got this error Fatal error: Can't use method return value in write context in? in line 14 error


<?php	
	class item_controller
		{
			public function set_safe($value)
				{
					return mysql_real_escape_string($value);
				}
			public function check_first()
			{
				$func_array = array();
				
				if(isset($_POST['new']) && 'Add' == $_POST['new'])
					{
				if(empty($this->set_safe($_POST['categoryname'])));
			{
				$func_array[] = 'invalid value, category';
			}
				else
				{
					$this->set_safe($_POST['categoryname']) = stripslashes($this->get_safe($_POST['categoryname']));
				}
			if(empty($this->get_safe($_POST['productname'])))
			{
				$func_array[] = 'invalid value, Product/Item';
			}
				else
			{
				$this->get_safe($_POST['productname']) = stripslashes($this->get_safe(['productname']));
			}
				if(empty($this->get_safe($_POST['description'])))
			{
			$func_array[] = 'invalid value, Description';
			}
				else
		{
			$this->get_safe($_POST['description']) = stripslashes($this->get_safe($_POST['description']));
		}
			if(sizeof($creat_array)>0)
			{
			foreach($func_array as $new_array);
				echo "$new_array";
			}
			else
		{
			require '../new_function/new_item.php';
		}
							}
						else
							{
								return false;
							}
			}
		}
	$controller = new item_controller();
	$controller->check_first();
?>
Link to comment
https://forums.phpfreaks.com/topic/275865-using-mysql_real_escape_string-error/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.