用户
 找回密码
 入住 CI 中国社区
搜索
查看: 2481|回复: 1
收起左侧

[已解决] $this->db->query问题

[复制链接]
发表于 2010-5-5 14:09:57 | 显示全部楼层 |阅读模式
$this->db->query("select password from person where name =? ",$_POST["name"]);
这样的语法错吗?

下面是我显示的错误:
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 '' at line 1
select password from person where name =
发表于 2010-5-5 14:19:49 | 显示全部楼层
请仔细看手册:
PHP复制代码
$sql = "SELECT * FROM some_table WHERE id = ? AND status = ? AND author = ?";
$this->db->query($sql, array(3, 'live', 'Rick'));
复制代码


你看看你的和手册例子一样吗?

http://codeigniter.org.cn/user_guide/database/queries.html

本版积分规则