[Sqlrelay-discussion] php, bind variables and postgresql
Brought to you by:
mused
|
From: Chris <dm...@gm...> - 2008-11-10 04:47:55
|
Hi all,
I'm looking to use sqlrelay with php & postgresql but having some
trouble getting it working properly.
Using sqlrelay 0.39.4 (compiled from source) on ubuntu (8.0.4) against
postgresql 8.3 (ubuntu package).
I've tried the pear db method and the non-pear method but both seem to
not process bind variables correctly.
Copied pretty much verbatim from the manual (except tablename & field
names changed):
<?php
dl("sql_relay.so");
$con=sqlrcon_alloc("localhost",9000,"","user1","password1",0,1);
$cur=sqlrcur_alloc($con);
sqlrcur_prepareQuery($cur,"select * from sq_ast where assetid=:assetid");
sqlrcur_inputBind($cur,"assetid","43");
sqlrcur_executeQuery($cur);
for ($row=0; $row<sqlrcur_rowCount($cur); $row++) {
echo "Row: " . $row . "\n";
for ($col=0; $col<sqlrcur_colCount($cur); $col++) {
echo sqlrcur_getField($cur,$row,$col);
echo ",";
}
echo "\n";
}
sqlrcur_free($cur);
sqlrcon_free($con);
Postgres error log says:
ERROR: syntax error at or near ":" at character 36
STATEMENT: select * from sq_ast where assetid=:assetid
I'm sure I'm missing something really simple but can't work out what it
is. Any suggestions very welcome.
Thanks!
--
Postgresql & php tutorials
http://www.designmagick.com/
|