Hello everyone.
I currently have to implement a query on a postgres database using a prepared statement. My current code looks like this:
$arrFilter = array("", "");
$result = $db->prepare("select_music", "SELECT * FROM tblmusik WHERE lm_titel LIKE '%" . "$1" . "%' AND lm_text LIKE '%" . "$2" . "%');
( db->prepare() just executes pg_prepare() )
I then execute this query:
if (isset($data['lm_titel'])) {
$arrFilter[0] = $data['lm_titel'];
}
if (isset($data['lm_text'])) {
$arrFilter[1] = $data['lm_text'];
}
$result = $db->execute("select_music", $arrFilter);
But i get the following error:
Warning: pg_prepare(): Query failed: ERROR: could not determine data type of parameter $1 in /home/freevma/htdocs/freeVMA/global/cls/db.php on line 110
I would be happy to get this running, and appreciate your help!
brot