<?php

require_once($_SERVER['DOCUMENT_ROOT'] . '/sys/db.php');

foreach ($_POST as $paramName => $paramValue) {
  if ($paramName == "selectid") 
    $project_id = $paramValue;  
  else if ($paramName == "ids") 
    $pi_ids = explode(",", $paramValue);  
}

//$pi_id = $pi_ids[$i];
//$cnt = count($pi_ids);
//print_r ("cnt:$cnt");

//print_r ("pi:$pi_id");

$dal = new DAL();

for ($i=0; $i<count($pi_ids); $i++) {

  $pi_id = $pi_ids[$i];
  $sql = "DELETE FROM pif WHERE id = $pi_id ";
  $result = $dal->query($sql);

}

echo json_encode($project_id);

?>

