gpt4 book ai didi

php - SQL 错误 - CodeIgniter 登录错误

转载 作者:行者123 更新时间:2023-11-30 22:35:39 25 4
gpt4 key购买 nike

我在学习 CodeIgniter 的同时尝试创建一个登录函数。我已经验证用户名和密码都是正确的。密码使用 Phppass codeigniter 密码库加密。

这是我使用正确信息登录后出现的错误。

A Database Error Occurred

Error Number: 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

'(`session_id`, `ip_address`, `user_agent`, `last_activity`)
VALUES ('826f937fed9' at line 1

INSERT INTO (`session_id`, `ip_address`, `user_agent`,
`last_activity`) VALUES ('826f937fed9185e2c121ec06b1b44b6a', '::1',
'Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/53', 1442454002)

Filename: libraries/Session.php

Line Number: 327

最佳答案

正如 PHP 聊天室中的 Jarred Farrish 和 Darack 所指出的,错误就在我面前!我忘了将我的 CodeIgniter 数据库 tbl 名称添加到配置中!好吧,不完全是。我以为我正确地遵循了 CodeIgniter 配置中的说明,但显然不是!由于文档略有不同,您实际上必须添加

$config['sess_table_name'] = 'ci_sessions';

到您的 config.php 文件。添加后,CodeIgniter 将正确地将用户数据存储在提供的表名中。

关于php - SQL 错误 - CodeIgniter 登录错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32620809/

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