Re: DBD::Pg problem - Mailing list pgsql-general

From Doug McNaught
Subject Re: DBD::Pg problem
Date
Msg-id 87ad6a9eoi.fsf@asmodeus.mcnaught.org
Whole thread Raw
In response to Re: DBD::Pg problem  (Barbara Lindsey <blindsey@cog.ufl.edu>)
List pgsql-general
Barbara Lindsey <blindsey@cog.ufl.edu> writes:

> When I have problems like this, I do something like this:
> $sql="insert into it_contact (email, to_email,
> subject,details,modify,parent) values(
> '".$from."','".$to,"','".$subject."','".$body."',
> now(),'".$parent."')";
>
> Then you dont have to bind params. You can just prepare and execute.

If you do this in production (rather than just for debugging) you may
be vulnerable to an SQL injection attack...

> Besides that, you can print the $sql string with the expanded
> variables and copy and paste it into psql to see if that gets you a
> different error to help debug if it is not already obvious when you
> see the whole SQL.

...but it is useful for debugging.

-Doug

pgsql-general by date:

Previous
From: "Chris Travers"
Date:
Subject: Re: Feature Request for 7.5
Next
From: Harald Fuchs
Date:
Subject: Re: DBD::Pg problem