I was going to fetch a column from database given as a POST param, so I started to write a code:
$db->select()->from('table', array('field' => $PARAM))->query()->fetchAll();
Then I started to wonder if it is safe method to pass $PARAM
to the query? I searched some web and documentation but didn't find unequivocal answer.
So I made some experimets, giving the $PARAM
different values and watching output query. What I noticed was that ` characters were prepended by another ` characters, but \ or \n etc. remained unchanged.
My question is: Is it safe? Is it enough to escape only ` characters? Manual says, that those other characters should also be escaped.