This does not work:
$dbh = new PDO("dblib:host=xxxx;dbname=xxx", "xxxxx", "xxxxx");
$sth = $dbh->prepare("{exec wcweb_UserInfo(?)}");
$sth->bindParam(1, $name);
$sth->execute();
while($result = $sth->fetch(PDO::FETCH_ASSOC)) {
var_dump($result);
}
This also does not work:
$dbh = new PDO("dblib:host=xxxxx;dbname=xxxx", "xxxxx", "xxxx");
$sth = $dbh->prepare("{call wcweb_UserInfo(?)}");
$sth->bindParam(1, $name);
$sth->execute();
while($result = $sth->fetch(PDO::FETCH_ASSOC)) {
var_dump($result);
}
This DOES work:
$dbh = new PDO("dblib:host=xxxxx;dbname=xxxx", "xxxxx", "xxxx");
$sth = $dbh->prepare("exec wcweb_UserInfo @userid=?");
$sth->bindParam(1, $name);
$sth->execute();
while($result = $sth->fetch(PDO::FETCH_ASSOC)) {
var_dump($result);
}
I tried the above using 2 that did not work with and without the curly brackets, etc. I know some would say, well just do it the way it works? .. The problem is I am porting an exising application from an IIS Server using the sqlsrv_query library to a Linux server.
All of the database calls in the app are written in functions that use this method: {call wcweb_UserInfo(?)} .. None of the parameter names are specified, so I would have to modify every database call to include the parameter names. I was under the impression that the PDO library for PHP5 can do those same kind of calls?
Help! Is there something I am doing wrong or is it just that PDO can't make those kinds of calls?
For some reason this works:
I might be able to live with this. Anyone know why the other methods do not work? Is it a difference in the libraries?