"SELECT name, salary * percent * ".(int)$_POST['val']." AS value FROM table WHERE 1=1"
"SELECT SUM(salary * percent * ".(int)$_POST['val'].") AS sum FROM table WHERE 1=1"
SELECT
COALESCE(name, 'Total') AS name,
SUM(salary * percent * 3) AS result
FROM salaries
GROUP BY name
WITH ROLLUP;
<?php
$query = "SELECT
COALESCE(name, 'Total') AS name,
SUM(salary * percent * :multiplayer) AS result
FROM salaries
GROUP BY name
WITH ROLLUP;";
$stmt = $pdo->prepare($query);
$stmt->execute(['multiplayer' => 3]);
$result = $stmt->fetchALL(PDO::FETCH_ASSOC);
var_export($result);