My code is as follows:
$stmt = $this->db->prepare("INSERT INTO favorites (id, profile_id, item_id) VALUES(?, ?, ?)");
if ($stmt)
{
$stmt->bind_param("sss", $maxID, $provider, $ID);
if(!$stmt->execute())
{
echo ("Error" . $this->db->error);
return $this->db->error;
}
else
{
echo("success");
}
$stmt->close();
}
else
{
echo ("Error" . $this->db->error);
return $this->db->error;
}
Despite my best efforts, this prepared statement is not doing anything. When I type the values directly into MYSQL prompt, it works properly. However, when I run this script, it does nothing.
Notes: $maxID, $provider, $ID are all valid values to insert. It throws no errors on the script or on the server error log. I'm very confused about why it does not add a row. Is there a glaring mistake in my code?
Thanks!!
EDIT: Added up new code, same thing. Execute is passing as well.