<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
	<head>
		<title>MAJ Stock</title>
		<link href="stock.css" rel="stylesheet" type="text/css">
		<meta http-equiv="content-type" content="text/html; charset=UTF-8">
	</head>
	<body>
		<br><br><h2>Liste des colonnes à mettre à jour &nbsp;&nbsp;&nbsp;&nbsp;
		<button onclick=window.open('stock1.php')>MAJ simple</button> <button onclick=window.open('stock2.php')>MAJ et RAZ</button></h2>
		<?php
		$connexion = "host='192.168.0.11' dbname='PharmagedonDate' user='openpg' password='openpgpwd'";
		$s = "select relname, attname from pg_attribute join pg_class on (relfilenode = attrelid) ";
		$s .= "join pg_tables on (relname = tablename) join pg_type on (typelem = atttypid) ";
		$s .= "where schemaname = 'public' and (typname like '_timestamp' or typname like '_date') ";
		$s .= "order by 1,2";	
		$c = pg_connect($connexion);
		$r = pg_query($c, $s);
		$t = pg_fetch_all($r);

		$precedent = "0";
		echo '<dl>';
		foreach ($t as $lig)
			{
			if($precedent != $lig["relname"])
				{
				echo '</dl><dl>';
				echo "<dt>".$lig["relname"]."</dt>";
				$precedent = $lig["relname"];
				}
			echo	'<dd>'.$lig["attname"].'</dd>';
			}
		echo "</dl>";
		$b = pg_close($c);
		echo "<br>";
		echo "<br>";
		?>
	</body>
</html>