self inserting form

Hi!

I am trying to couple php with postgresql to create a form which inserts into the database directly. For that I’ve created a relation ‘users’ in a database named ‘project’ in postgresql. Here’s the php code for the form:

<?php if($submit != "Insert") { ?> My web form User Id:
User Name
Credit

<?php } else { $connection = pg_connect("dbname=project user=postgres host=localhost password=pass"); if (!$connection) { print("Connection Failed."); exit; } pg_exec($connection, "INSERT INTO users VALUES ('$id', '$username', '$credit')");

}
?>

In spite of all my efforts, I am not able to insert into a single entry into my database using this form. Please help me fix it.

Sponsor our Newsletter | Privacy Policy | Terms of Service