CodeIgniter Forums
CI FULLTEXT pagination - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forum-22.html)
+--- Thread: CI FULLTEXT pagination (/thread-51856.html)



CI FULLTEXT pagination - El Forum - 05-21-2012

[eluser]smartweb[/eluser]
Hi,
I have a database, which has 1.5 million records. I need to constantly query the database and generates the paging record. Who can tell me how to write the T-the sql?

The table structure is as follows

CREATE TABLE IF NOT EXISTS `test` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`title` varchar(200) DEFAULT NULL,
`body` text,
PRIMARY KEY (`id`),
FULLTEXT KEY `title` (`title`,`body`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=86 ;


CI FULLTEXT pagination - El Forum - 05-21-2012

[eluser]smartweb[/eluser]
My wrong class here

function getproudctsList($page,$pagesize,$class,$region)//产品列表
{
//$sql = "select * from coname_infor where match (coname) AGAINST ('".$t."*' IN BOOLEAN MODE) ";
//
$str_search=$class." ".$region."*";
$query=$this->db->where("MATCH (`title`,`body`) AGAINST ('$str_search' IN BOOLEAN MODE)")->get("test");
$this->total ==$query->num_rows();
$query=$this->db->where("MATCH (`title`,`body`) AGAINST ('$str_search' IN BOOLEAN MODE)")->get("test",$pagesize,$page)->result_array();

return $query;
}


return error

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 'AGAINST ('all all*' IN BOOLEAN MODE)' at line 3