php tutorial database tutorial content search (search for the specified content and output) / * First let's create a search data table create table if not exists `search` ( `id` int (4) not null auto_increment, `keyword` varchar (500) not null, primary key (`id`) ) engine = myisam default charset = utf8 auto_increment = 1;
$ conn = mysql tutorial _connect ('localhost', 'ac', '1'); / / Here ac user name, a password is changed to your own mysql
$ res = mysql_db_query ('abc', "select * from search where keyword = 'content search'") or die (mysql_error ());
if (mysql_num_rows ($ res) == 1) { while ($ row = mysql_fetch_assoc ($ res)) { foreach ($ row as $ key => $ val) { echo $ row ['keyword'], '<br>'; } } } / * The principle is very simple to achieve According to the data submitted by the user mysql data table query whether the same, there is no output will not operate. This is a simple record search code. Reproduced original source indicate the source www.jzread.com
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.