以下のステートメントが基本的に機能しない理由がわかりません。一言で言えば、テーブルに だけが見つからない$result
場合にステートメントを実行したいのです。それが見つかった場合は、ステートメントを実行してもらいたいと思います。$product_id
$images
inner
両方のステートメントはphpMyAdminを介して$result
機能し、ステートメントは使用するだけで機能します$this->db->query
コード:
public function product_delete($product_id)
{
$table = $this->_table_products;
$images = $this->_table_product_images;
$result = $this->db->query("SELECT `id` FROM $table WHERE $table.id ='$product_id'");
if(mysqli_num_rows($result) !== 0)
{
$this->db->query("DELETE FROM $table WHERE $table.id = '$product_id'");
}else{
$this->db->query("DELETE FROM $table INNER JOIN $images ON $table.id = $images.product_id WHERE $images.id = $product_id");
}
}