I failed to find out by browing google. So i decided to ask here. Is parameterezed query supported i postgre using php pdo?
If not. How can i reach the same safety?
Note that safety, thus injection prove is an absolute must. Using another database is not an option as a sidenote.
In a response to Fonini;
Parameterized queries like so:
$st = $db->prepare(
"insert into vendors set
first_name = :first_name,
last_name = :last_name"
);
$st->execute(array(
':first_name' => $vendor->first_name,
':last_name' => $vendor->last_name
));
not using bindParam
This doesn't insert for me.
My code looks like so:
$project = new Project();
$project->id = 'sequence string';
$project->projectName = 'A project name';
$project->saveProject();
and in the project model:
public function saveProject() {
$this->_db->query("INSERT INTO projects VALUES (:id,:projectName)", array(':id' => $this->_projectFields['id'], ':projectName' => $this->_projectFields['projectName']))->save();
}
the query method in my db class puts the query in the private $_query field, and the aray parameter in the private $_parameters field. I then call the save method, which prepares the statement, giving $this->_query as parameter to PDO::prepare(), and then call PDO::execute giving $this->_parameters as parameter. This fails to insert