Am trying to deploy my application online. Every sql statements where written with PDO. I know how to do all sorts of validations and sanitization.
with the sample codes below. Am I protected against sql injection attack
connect.db
$db = new PDO ('mysql:host=localhost;dbname=mydbinfo;charset=utf8', 'root', 'ROOT123');
data.db
// select
$query = $db->prepare('SELECT * FROM users where username = :username');
$query->execute( array(':username' => $_POST['username']) );
//insert
$ins = $db->prepare('insert into users(username)values(:username)');
$ins->execute( array(':username' => $_POST['username']) );