Home  >  Article  >  Backend Development  >  php search function

php search function

WBOY
WBOYOriginal
2016-07-29 09:12:173371browse

I’ve been very irritable recently and don’t know how to start learning a piece of code, so I want to write more things for future review.

Recently, after looking at the search function for a few days, I wanted to modify and optimize the search function of phpcms, but I didn’t have any clue. Maybe I slept too late recently, so I rewrote the simple search and organized my ideas.

A simple search only requires constructing a query statement

<code>$sql = "<span><span>SELECT</span> * <span>FROM</span><span>sql</span><span>WHERE</span> $ziduan <span>LIKE</span><span>'%$content%'</span><span>"</span></span></code>

After constructing the SQL database query, you can execute the database query

<code><span>$rs</span><span>=</span><span>$db</span><span>-></span>query(<span>$sql</span>);
<span>$rsNum</span><span>=</span><span>$rs</span><span>-></span>num_rows;   <span>//返回查询的行数</span>echo <span>"本次查询到 $rsNum 条记录"</span>;</code>
').addClass('pre-numbering').hide(); $(this).addClass('has-numbering').parent().append($numbering); for (i = 1; i ').text(i)); }; $numbering.fadeIn(1700); }); });

The above has introduced the PHP search function, including related content. I hope it will be helpful to friends who are interested in PHP tutorials.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn