12345678910111213141516171819202122232425262728293031 |
- <?php
- /**
- * Created by PhpStorm.
- * User: root
- * Date: 31.07.18
- * Time: 11:27
- */
- require_once "Model.php";
- class User extends Model
- {
- public function __construct()
- {
- static::$table = "user";
- 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);
- }
- }
|