DB2 - wrong number of parameters

DB2 - wrong number of parameters

am 17.07.2006 20:01:49 von Pablo Garay

--0-227635547-1153159309=:43229
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable

Hi!

I=B4m working with PHP 5 and using the DB2 database.
I=B4m trying to update a jpg file, that=B4s save on the database.
here=B4s the code:

=20
$fp =3D @fopen("$caminho/$nome_arquivo", 'r');
$content =3D fread($fp, filesize("$caminho/$nome_arquivo"));
$content =3D bin2hex($content);
fclose($fp);
=20
$conn =3D $this->DB2->getConn(); //get the connection id

$q =3D "update dbsm.FUNCIONARIOS set FOTO=3D? where ID_FUNCIONARIO=3D?"=
;
$res =3D odbc_prepare ($conn, $q);

$array =3D array();
$array[0] =3D $content; //file
$array[1] =3D $idFuncionario;
=20
$exc =3D odbc_execute($res, $array);

but when I run it, the folow warning appears:

Warning: odbc_execute() [function.odbc-execute]: SQL error: [IBM][CLI Drive=
r] CLI0100E Wrong number of parameters. SQLSTATE=3D07001, SQL state 07001 i=
n SQLExecute in C:\Arquivos de programas\Apache Group\Apache2\htdocs\princi=
pal\Portal\Repositorio\Funcionarios.class.php on line 170

what=B4s the problem???

thanks

Pablo Garay
Iju=ED - UNIJUI
RS - Brasil


--0-227635547-1153159309=:43229--

Re: DB2 - wrong number of parameters

am 18.07.2006 02:06:27 von Chris

Pablo Garay wrote:
> Hi!
>
> I´m working with PHP 5 and using the DB2 database.
> I´m trying to update a jpg file, that´s save on the database.
> here´s the code:
>
>
> $fp = @fopen("$caminho/$nome_arquivo", 'r');
> $content = fread($fp, filesize("$caminho/$nome_arquivo"));
> $content = bin2hex($content);
> fclose($fp);
>
> $conn = $this->DB2->getConn(); //get the connection id
>
> $q = "update dbsm.FUNCIONARIOS set FOTO=? where ID_FUNCIONARIO=?";
> $res = odbc_prepare ($conn, $q);
>
> $array = array();
> $array[0] = $content; //file
> $array[1] = $idFuncionario;
>
> $exc = odbc_execute($res, $array);
>
> but when I run it, the folow warning appears:
>
> Warning: odbc_execute() [function.odbc-execute]: SQL error: [IBM][CLI Driver] CLI0100E Wrong number of parameters. SQLSTATE=07001, SQL state 07001 in SQLExecute in C:\Arquivos de programas\Apache Group\Apache2\htdocs\principal\Portal\Repositorio\Funcionari os.class.php on line 170
>
> what´s the problem???

Looks like a bug to me.

I found this one: http://bugs.php.net/bug.php?id=37646

which is kinda related.

Search bugs.php.net and see if it has been reported.

--
Postgresql & php tutorials
http://www.designmagick.com/

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php