Η τεχνολογία PHP

Παρόμοια αυστήματα

Χαρακτηριστικά PHP

Παράδειγμα (PHP 4)

<?php
$db = pg_pconnect ("host=localhost dbname=comments user=george password=george");
$update="insert into comments(name,email,comment) values ('$name','$email','$comments')";
echo $name,$email,$comments;
pg_exec ($db,$update);
?>

Παράδειγμα (PHP 5)

<?php
        if(isset($HTTP_POST_VARS['name']) $name=$HTTP_POST_VARS['name'];
        if(isset($HTTP_POST_VARS['email']) $name=$HTTP_POST_VARS['email'];
        if(isset($HTTP_POST_VARS['comments']) $name=$HTTP_POST_VARS['comments'];

        $db = pg_pconnect ("host=localhost dbname=comments user=george password=george")
                or die("Couldn't Connect to the database") ;
        $update = "insert into comments(name,email,comment) values ('$name','$email','$comments')";
        echo $name,$email,$comments;
        if (!pg_exec($db,$update))
                echo "There was a problem with the sql statement" ;
        else
                echo "SQL Excecuted Successfully" ;

?>