Re: Stored procedures, PDO, and PHP issue - Mailing list pgsql-php

From Andy Shellam
Subject Re: Stored procedures, PDO, and PHP issue
Date
Msg-id 4A8C6B7D.7020806@networkmail.eu
Whole thread Raw
In response to Re: Stored procedures, PDO, and PHP issue  (Eric Chamberlain <Eric.Chamberlain@zonarsystems.com>)
Responses Re: Stored procedures, PDO, and PHP issue  (Eric Chamberlain <Eric.Chamberlain@zonarsystems.com>)
List pgsql-php
Hi Eric,

>
> Unfortunately this does not work or I maybe doing it wrong.  New code:
> $stmt = $db->prepare("SELECT is_password_expired($1::integer,
> $2::varchar);
> $stmt->bindValue(1, settype($userId, "integer"), PDO::PARAM_INT);
> $stmt->bindValue(2, $hashPass, PDO::PARAM_STR);
> $stmt->execute();

settype() doesn't return anything so it needs to be used on it's own
line.  E.g.:

$userId = "2"; // string
settype($userId, 'integer'); // $userId is now an integer
$stmt->bindValue(1, $userId, PDO::PARAM_INT);

>
> I get a blank screen.  I've tried setting the error reporting level to:
>
> error_reporting(E_ALL);
>
> before calling the above code.  Our servers are configured to display
> errors, etc.  The fact that it just goes blank tells me there is a
> bigger issue going on.

Does your server definitely have display_errors set to On as well as the
error_reporting line, and it's not been overridden by your application?
I've only ever known really serious errors (i.e. core dumps) to not
display anything even when display_errors is set to on.  What's logged
in your Apache or IIS error log?

Lastly have you tried "named" parameters?  From the PHP manual:
(actually the PostgreSQL syntax "$1::integer" I suggested may have
caused PHP to crash as PDO uses a colon to introduce a named parameter.)

|$stmt = $dbh->prepare("INSERT INTO REGISTRY (name, value) VALUES (:name, :value)");
$stmt->bindParam(':name', $name);
$stmt->bindParam(':value', $value);|

Andy

pgsql-php by date:

Previous
From: Bill Moran
Date:
Subject: Re: Stored procedures, PDO, and PHP issue
Next
From: Eric Chamberlain
Date:
Subject: Re: Stored procedures, PDO, and PHP issue