this is the error Fatal error: Call to undefined function assign(
 this is the code, as you can see i obviously have defined the function so why is it not working
class shades {     function create($name, $shades, $slug, $shortDesc, $longDesc, $position){         $name = sanitize_paranoid_string($name);         $slug = slug($name);         $shortDesc = sanitize_sql_string($shortDesc);         $longDesc = sanitize_sql_string($longDesc);         $query = mysql_query("INSERT INTO products (type, name, slug, shortDesc, htmlDesc, position)VALUES('shades','$name','$slug','$shortDesc','$longDesc','$position')")or die(mysql_error());           $ID = mysql_insert_id();         assign($shades, $ID);         if($query) {return true;}         else {return false;};     }     function delassign($toID){         mysql_query("DELETE FROM assign WHERE type='shades' AND toID='$toID'")or die(mysql_error());         }     function assign($shades, $toID)     {         foreach($shades as $shade)         {             $result = mysql_query("INSERT INTO assign(type, typeID, toID)VALUES('shades','$shade','$toID')")or die(mysql_error());             if($result){echo "Added!";}             else{echo"Not Added!";}         };       } } 
                You dont have a function named assign(), but a method with this name. PHP is not Java and in PHP you have to make clear, if you want to call a function
assign()   or a method
$object->assign()   In your case the call to the function resides inside another method. $this always refers to the object, in which a method exists, itself.
$this->assign() 
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With