I am trying out PDO in PHP for the first time. I thought that PDOStatement->bindParam() would be a cool way to set the datatypes of the values that i pass in to the sql query. But somehow it doesnt work for me. For example I set the type of a variable to INT in bindParam call. But it still doesnt throw error even when I pass pure string values to it. Maybe I am doing something wrong. Here is the snippet of the code..
$query = "select * from PDO_TABLE where A_COLUMN = :test1 or B_COLUMN = :test2";
$test1 = '0';
$test2 = 'a';
$preparedStatement = $conn->prepare($query);
echo $preparedStatement->bindParam(':test1', $test1, PDO::PARAM_INT);
echo $preparedStatement->bindParam(':test2', $test2, PDO::PARAM_INT);
$preparedStatement->execute();
Am I doing everything properly? Isnt this supposed to throw error for the parameter test2?