Skip to content

Instantly share code, notes, and snippets.

@mchelen
Created May 22, 2017 17:46
Show Gist options
  • Save mchelen/dc16290e011c575b3c92fb874f1b7008 to your computer and use it in GitHub Desktop.
Save mchelen/dc16290e011c575b3c92fb874f1b7008 to your computer and use it in GitHub Desktop.
<?php
/*
PHP Warning: db2_bind_param(): Describe Param Failed
*/
$conn = db2_connect('db', 'user', 'pass');
$sql = "
SELECT *
FROM MYTABLE
WHERE FOO = '?'
";
$foo = 'bar';
$stmt = db2_prepare($conn, $sql);
db2_bind_param($stmt, 1, "foo", DB2_PARAM_IN);
if (db2_execute($stmt)) {
while ($row = db2_fetch_assoc($stmt)) {
var_dump($row);
}
}
@mchelen
Copy link
Author

mchelen commented May 22, 2017

line 11 should be:
WHERE FOO = ?

@kim208
Copy link

kim208 commented Nov 2, 2017

Are you connecting to a remote IBM i? We are having the same issue when we connect to a remote IBM i, and try to query a table in the IASP. If we query a table in *SYSBAS, db2_bind_param works just fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment