Fuzzy query and SQL fuzzy query
Public function Index () {// fuzzy query by account, real name, and mobile phone number $ user = M ('cuser'); $ where = "(IFNULL (projectno ,'". session ("user") ['projectno']. "') = '". session ("user") ['projectno']. "'OR projectno ='') "; if (! Empty (I ('Param. name ') {$ name = trim (I ('Param. name '); $ where. = "and name like '% {$ name} %' OR realname like '% {$ name} %' OR phone like '% {$ name} % '";} $ this-> assign ('name', $ name); $ count = $ user-> where ($ where)-> count (); /* The total number of incoming records and the number of records displayed on each Page in the instantiated paging class */$ Page = new Page ($ count, 10 ); /// * display output by Page */$ show = $ Page-> show (); /* perform paging data query. Note that the parameters of the limit Method must use the property of the Page class */$ page = I ('Param. p '); if (empty ($ page) {$ page = 1 ;}$ list = $ user-> where ($ where)-> order ("id desc ") -> limit ($ Page-> firstRow. ",". $ Page-> listRows)-> select (); $ this-> assign ('LIST', $ list); $ this-> assign ('page', $ show ); $ this-> display (index );}