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>
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.