I have a simple class that is causing me some problems. There are 2 problems. I haven’t linked my html file, just the class. When I need to use my insert function, it says it is undefined. Also, even if I manually try to insert something into the database, nothing happens.
mysql_connect(“come”, “at”, “me”) or die(mysql_error());
mysql_select_db(“bro”) or die(mysql_error());
class Update
{
public $input;
public function assignCheck($postRequest)
{
if(isset($_POST[$postRequest]))
{
$this->input = $_POST[$postRequest];
insert($postRequest);
return $this->input;
}
else
{
return false;
}
}
public function insert($insertRequest)
{
mysql_query("INSERT INTO updates (update) VALUE ($insertRequest)");
}
}
In order to call your insert function, you have to use
$this->insert($postRequest)in your if statement ofassignCheckfunction