Yohanne Posted April 24, 2013 Share Posted April 24, 2013 please help to define, where couse the error: i foud like this error Fatal error: Call to undefined method new_request::the_suppliment() public function the_suppliment() { foreach($_POST as $key => $values) { $mydata[$key] = $this->cleared($values); } if(isset($mydata['new']) && 'New' == $mydata['new']) { $this->set_query = ("INSERT INTO ocs_item_list(user_id,request,cat_name,prd_name,quantity,date_request) VALUES('$mydata[id]','$mydata[request]','$mydata[cat]','$mydata[subcat],'$mydata[quantity],'$mydata[thedate]')"); $this->var_result = mysql_query($this->get_query()) or die("$this->get_query". mysql_error()); } } } $nnew = new new_request(); $nnew->the_suppliment(); Link to comment https://forums.phpfreaks.com/topic/277236-call-to-undefined-method/ Share on other sites More sharing options...
Hall of Famer Posted April 24, 2013 Share Posted April 24, 2013 The error means that the method new_request::the_suppliment() does not exist. Since you only show a fragment of your code its difficult to help you with. Are you sure the method the_suppliment() is defined inside class new_request? You dont seem to have made a typo though, so thats the only clue I have for now. Link to comment https://forums.phpfreaks.com/topic/277236-call-to-undefined-method/#findComment-1426222 Share on other sites More sharing options...
Q695 Posted April 24, 2013 Share Posted April 24, 2013 Any variable not declaired to be internal to the form needs to be called a global as its not a local variable. See: function Sum() { global $a, $b; $b = $a + $b; } Link to comment https://forums.phpfreaks.com/topic/277236-call-to-undefined-method/#findComment-1426230 Share on other sites More sharing options...
Yohanne Posted April 24, 2013 Author Share Posted April 24, 2013 thank you for all your responce and advice. and earlier from what you said, i check everyline and variable and i notice this $new = new new_request(); instead $new = new new_request_(); Couse->solve Thanks you Link to comment https://forums.phpfreaks.com/topic/277236-call-to-undefined-method/#findComment-1426241 Share on other sites More sharing options...
Yohanne Posted April 24, 2013 Author Share Posted April 24, 2013 On 4/24/2013 at 4:04 AM, jayson_ph said: please help to define, where couse the error: i foud like this error Fatal error: Call to undefined method new_request::the_suppliment() { public function the_suppliment() { foreach($_POST as $key => $values) { $mydata[$key] = $this->cleared($values); } if(isset($mydata['new']) && 'New' == $mydata['new']) { $this->set_query = ("INSERT INTO ocs_item_list(user_id,request,cat_name,prd_name,quantity,date_request) VALUES('$mydata[id]','$mydata[request]','$mydata[cat]','$mydata[subcat],'$mydata[quantity],'$mydata[thedate]')"); $this->var_result = mysql_query($this->get_query()) or die("$this->get_query". mysql_error()); } } } $nnew = new new_request(); $nnew->the_suppliment(); Link to comment https://forums.phpfreaks.com/topic/277236-call-to-undefined-method/#findComment-1426242 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.