gpt4 book ai didi

php - 如何修复 "Syntax error or access violation: 1064"

转载 作者:行者123 更新时间:2023-11-29 15:41:41 26 4
gpt4 key购买 nike

我是 Laravel 世界的新手。在 php artisan migrate -seed 命令之后,我收到错误玛丽亚数据库 10.4.6PHP 7.3

SQL代码的问题不应该是

DB::table('settings')->insert($typi_settings);
$max = DB::table('settings')->max('id');
DB::select(DB::raw("select setval('typicms_settings_id_seq', $max)"));

SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ''typicms_settings_id_seq', 15)' at line 1 (SQL: select setval('typicms_settings_id_seq', 15))

最佳答案

您已经通过调用 QueryBuilder 上的 select 方法来执行 select,请尝试以下操作:

DB::select(DB::raw("setval('typicms_settings_id_seq', $max)"));

关于php - 如何修复 "Syntax error or access violation: 1064",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57569675/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com