view中 : 标题:<?=anchor("message/enter/$row->id","$row->title");?>
点击后url:http://localhost/ci/index.php/message/enter/17,controller的enter():
$id = $this->uri->segment(3);
$sql = 'select * from entries where id = '+$id;
$data['message'] = $this->db->query($sql);
出现错误:
A Database Error OccurredError 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 '17' at line 1 17 Filename: C:\wamp\www\ci\system\database\DB_driver.php Line Number: 330
|