Reputation: 153
I've created this class:
class data
{
public function del($cat, $id)
{
global $dbh;
$del = $dbh->prepare("DELETE FROM :cat WHERE id = :id");
$del->bindParam(":cat",$cat);
$del->bindParam(":id", $id);
$del->execute();
}
}
And I'm running into an issue with binding the
:cat
variable to the statement, if I don't use bindParam for
:cat
and just tell it which table I want it to delete it from, for example:
$del = $dbh->prepare("DELETE FROM table1 WHERE id = :id");
It works fine.
I know it has to be some stupid error, but I can't for the life of me figure it out.
Upvotes: -1
Views: 84