ZF2 SQLSTATE [HY093]: Invalid parameter number: Parameter not defined

I have the error "SQLSTATE [HY093]: Invalid parameter number: parameter was not defined" when I try to save the array in the associated InnoDB, which makes no sense to me, because I already used the same method several times in the same application and connection it seems to work with the DB, because I can read and delete records without any problems.

I checked a lot of similar questions in the hope that they would solve mine, but could not find what resolved my problem.

This is the method I use to save in order to create an array and save it to the database:

 public function saveBest(Besten $besten)
{
    $GePunkte = (int) $besten->Punkte/$besten->Dauer;

    $data = array(
        'GePunkte'  => $GePunkte,
        'Name'      => $besten->Name,
        'Zeitpunkt' => $besten->Zeitpunkt,
        'Punkte'    => $besten->Punkte,
        'Dauer'     => $besten->Dauer,
        'GewäKat'   => $besten->GewäKat,
    );
    print_r($data);


    $this->tableGateway->insert($data);


}

I already used "print_r ($ data)" to check if the data in the array is complete, because I suspected this was causing the error.

print_r :

Array ( [GePunkte] => 0.125 [Name] => Test [Zeitpunkt] => 1451480345 [Punkte] => 1 [Dauer] => 8 [GewäKat] => Natur )

, , . GePunkte float, Name , Zeitpunkt as int, Punkte as int, Dauer as int GewäKat , .

, right, insert sql Phpmyadmin, :

INSERT INTO `bestenliste`(`Sid`, `GePunkte`, `Name`, `Zeitpunkt`, `Punkte`, `Dauer`, `GewäKat`) VALUES ([value-1],[value-2],[value-3],[value-4],[value-5],[value-6],[value-7])

Sid , , , .

, , , , - , .

- ?

+4

Source: https://habr.com/ru/post/1622219/


All Articles