1234567891011121314151617181920212223242526272829 |
- <?php
- /**
- * Created by PhpStorm.
- * User: root
- * Date: 31.07.18
- * Time: 11:00
- */
- class Author extends Model
- {
- public function __construct()
- {
- static::$table = "author";
- static::$fields = ['name'];
- static::$pk = "id";
- parent::__construct();
- }
- public function createRow(string $name)
- {
- $query =
- "INSERT INTO" . self::$table . " (`" . implode("`, `", self::$fields) . "`)" .
- " VALUES (" . "'" . $name . "'" . ");";
- $this->connection->exec($query);
- }
- }
|