//contador $ident="flashchse"; //aumentar $inc="yes"; //Mostrar en pantalla $print="yes"; // connect to the database $conn = pg_Connect("localhost", "5432", "", "", "phcounter"); if (!$conn) { echo"Error to open the database"; exit; } if ($inc=="yes") { // update the value $update="update counter set value=value+1 where name='$ident'"; $ok=pg_exec($conn,$update); } if ($print=="yes") { // read the value $read="select value from counter where name='$ident'"; $eleg=pg_exec($conn,$read); $value=pg_result($eleg,0,"value"); // print the value echo "$value"; } // disconnect from the database $pos=pg_Close($conn); if (!$pos) { echo "Error to close the database"; exit; } ?>