Error, because no prefix in SQL query
-
Hello,
when reviewing subscriptions, there is an error =>'mydbname.wp_wc_comments_subscription' doesn't exist] SELECT COUNT(*) FROM wp_wc_comments_subscription WHERE email = '[email protected]';It does not have an DB prefix included, it includes its own prefix
wp_It is :
public function getSubscriptionsCount($userEmail) { $sql = $this->db->prepare("SELECT COUNT(*) FROM wp_wc_comments_subscription WHERE email = %s;", trim($userEmail)); $result = $this->db->get_var($sql); return $result; }It should be something like this =>
public function getSubscriptionsCount($userEmail) { $sql = $this->db->prepare("SELECT COUNT(*) FROM ".$this->dbprefix."wc_comments_subscription WHERE email = %s;", trim($userEmail)); $result = $this->db->get_var($sql); return $result; }
Viewing 8 replies - 1 through 8 (of 8 total)
Viewing 8 replies - 1 through 8 (of 8 total)
The topic ‘Error, because no prefix in SQL query’ is closed to new replies.