I'm working with SQLite3 in PHP.
A friend told me that I should prefer prepared statements, and I read this in many posts here on StackOverflow too. I want to understand the benefits of using prepared statements because I have to write much more lines, than regular escaping like using:
$db->exec("Insert INTO table VALUES(NULL,'".$db->escapeString($value)."')"
or using:
foreach($_POST as $k => $v) {
$_POST[$k] = $db->escapeString($v);
}
Why should I use prepared statements? What are the pros and cons?