環境
MAC
MAMP
FuelPHP 1.8.1
Authクラスのcreate_userメソッドを使うと以下のエラー
適当にxで伏せ字にしてます。
Fuel\Core\Database_Exception [ 1064 (1064) ]: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'group, profile_fields, last_login, login_hash, created_at) VALUES ('xx', 'XXXX' at line 1 [ INSERT INTO users (username, password, email, group, profile_fields, last_login, login_hash, created_at) VALUES ('xx', 'XXXXXXXX=', 'x@x.x', 1, 'a:0:{}', 0, '', xxx) ]
解決方法
fuel/app/config/db.phpファイルに「'identifier' => '`'」を追加
「`」はshift押しながら@マークを押す
<?php
return array(
'active' => 'mysqli',
'mysqli' => array(
'type' => 'mysqli',
'connection' => array(
'hostname' => 'localhost',
'database' => 'dbname',
'username' => 'xxxx',
'password' => 'xxxx',
'persistent' => false,
'compress' => false,
),
'identifier' => '`', //これを追加する
'table_prefix' => '',
'charset' => 'utf8',
'caching' => false,
'profiling' => true,
),
);