I send the year to my class and I want to insert records in the form AAAAMM ( integer ) The MM is of the form 01, 02 .... 11, 12. But it does not execute the class. Show error in the Insert .
public function InsertarMesesAnio($anio){
for ($i = 1; $i <= 12; $i++) {
$mes = str_pad($i, 2, "0", STR_PAD_LEFT);
$periodo = $anio.$mes;
$sql = "INSERT INTO tperiodo (periodo, estado)
VALUES :periodo, 'P'";
}
$BD = new ConexionDB();
$sth = $BD->prepare($sql);
$sth->bindParam(':anio', $anio, PDO::PARAM_INT);
$sth->execute();
}