嗨,我有下面的字符串要插入数据库
$data = array('url' => http://www.amazon.co.uk/hedge-trimmers/s?ie=UTF8&page=1&rh=i:aps,k:'hedge trimmers);
我已经很累了,但我有一个错误:
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 'hedge trimmers''' at line 1
SELECT * FROM seo_websites WHERE website = 'http://www.amazon.co.uk/hedge-trimmers/s?ie=UTF8&page=1&rh=i:aps,k:'hedge trimmers''
我想这是单引号。如果有人能帮助我,我将不胜感激。谢谢
最佳答案
您可以使用活动记录编写查询
$url="http://www.amazon.co.uk/hedge-trimmers/s?ie=UTF8&page=1&rh=i:aps,k:'hedge trimmers'";
$this->db->select('*');
$this->db->from('seo_websites');
$this->db->where('website',$url);