LoginSignup
3
2

More than 3 years have passed since last update.

FuelPHPのエラー (1064)You have an error in your SQL syntax..

Last updated at Posted at 2019-04-27

環境

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押しながら@マークを押す

fuel/app/config/db.php
<?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,
    ),
);

参考サイト
https://fuelphp.com/forums/discussion/comment/12002

3
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
2