Joshua Walusz wrote:
> Hello,
> Could anyone explain to me why this is not posting data to the PostgreSQL
> DB???? Please review my code listed below and let me know if you have any
> suggestions:

> $query = pg_exec($connection, "INSERT INTO users (username, password,
> company) VALUES ('$username', '$password', '$company')");

Hey Josh,
I like to issue a die statement when I get strange database errors. This
way you get the command that is about to execute.
Just copy the command and paste it into your database client command
window. Sometimes the DB will give you a more precise error message. And
if the insert works you know your connection is wrong and not your
command. I do this for MySQL but this practice should work for
PostgreSQL as well.

$sql = "INSERT INTO users (username, password, company) VALUES
('$username', '$password', '$company')";
die("$sql");

Run the above and paste the output into your SQL client program.

Reply via email to