<?php
	require_once '../../../autoload.php';

	$result = array (
			"status"	=> 'KO',
			"results"	=> array ()
	);
	
	$pdo = getPDO ();
		
	if ( $pdo )
	{
		$sql = "select integration_error from storagelist s group by integration_error order by integration_error";

		$s0 = $pdo->prepare ( $sql );

		if ( $s0->execute () )
		{
			$result['status'] ='OK';

			$d0 = $s0->fetchAll ();

			for ( $i=0; $i<count($d0); $i++ )
			{
				$res = array (	"error_type" 			=> $d0[$i]['integration_error'] );

				array_push ( $result['results'], $res );
			}
		}
	}
	
	header('Content-type: application/json');
	
	echo json_encode ( $result );
?>