src/MySQLHandler/MySQLHandler.php
private function prepareStatement()
    {
        //Prepare statement
        $columns = "";
        $fields  = "";
        foreach ($this->fields as $key => $f) {
            if ($f == 'id') {
                continue;
            }
            if ($key == 1) {
                $columns .= "$f";
                $fields .= ":$f";
                continue;
            }

            $columns .= ", $f";
            $fields .= ", :$f";
        }

        $this->statement = $this->pdo->prepare(
            'INSERT INTO `' . $this->table . '` (' . $columns . ') VALUES (' . $fields . ')'
        );
    }
private function prepareStatement()
    {
        //Prepare statement
        $columns = "";
        $fields  = "";
        foreach ($this->fields as $key => $f) {
            if ($f == 'id') {
                continue;
            }
            if ($key == 1) {
                $columns .= "$f";
                $fields .= ":$f";
                continue;
            }

            $columns .= ", $f";
            $fields .= ", :$f";
        }

        $this->statement = $this->pdo->prepare(
            'INSERT INTO `' . $this->table . '` (' . $columns . ') VALUES (' . $fields . ')'
        );
    }
private function prepareStatement ( ) { //Prepare statement $ columns = "" ; $ fields = "" ; foreach ( $ this -> fields as $ key => $ f ) { if ( $ f == 'id' ) { continue ; } if ( $ key == 1 ) { $ columns .= "$f" ; $ fields .= ":$f" ; continue ; } $ columns .= ", $f" ; $ fields .= ", :$f" ; } $ this -> statement = $ this -> pdo -> prepare ( 'INSERT INTO `' . $ this -> table . '` (' . $ columns . ') VALUES (' . $ fields . ')' ) ; }
Prepare the sql statment depending on the fields that should be written to the database
Prepare the sql statment depending on the fields that should be written to the database