example
example

求助 qb公寓报错了,未发现什么问题,求大佬看看。

HaoEr2047

哀殿天下第一
论坛元老
高级用户
认证用户
(node:25588) UnhandledPromiseRejectionWarning: Error: qb-apartments was unable to execute a query!
Field 'id' doesn't have a default value
INSERT INTO apartments (name, type, label, citizenid) VALUES (?, ?, ?, ?) ["apartment42660","apartment4","金霞大厦 2660","ITO01203"]
at @oxmysql/dist/build.js:21734:11
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async rawQuery (@oxmysql/dist/build.js:21726:10)
(Use `FXServer --trace-warnings ...` to show where the warning was created)
(node:25588) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
 

Yann

站长
管理成员
GTAOS管理组
认证卖家
认证用户
本 月 名 人 榜 最 佳
应该是数据库的问题,ID是缺失的。

解决方案:
随便找一个支持数据库编辑的软件(如Navicate Mysql)或者其他网页管理工具(如phpadmin),打开你要修改的游戏数据库,然后点击apartment表,再点击edit去修改表结构,找到id然后把它设置为主键(并且设置自动递增auto increase)

1699326187812.png

然后再执行你上边的插入
INSERT INTO apartments (name, type, label, citizenid) VALUES (?, ?, ?, ?) ["apartment42660","apartment4","金霞大厦 2660","ITO01203"]

重启服务器就行了
 

Yann

站长
管理成员
GTAOS管理组
认证卖家
认证用户
本 月 名 人 榜 最 佳
注意上边最好也把 “不是null” 点上
 
顶部