It should be like this,
$getProductAttributes = Db::getInstance()->executeS('SELECT COUNT(id_product_attribute) FROM `'._DB_PREFIX_.'product_attribute` WHERE id_product='.(int)$id_product); print_r($getProductAttributes, true);
then get the value from array.