簡體   English   中英

使用php,如何查詢存儲在MySQL表中行中的某些關鍵字以顯示相關信息?

[英]Using php, how do I query from certain keywords stored in rows in my MySQL table to display relevant information?

我有一個名為news的表,其中有$ keyword行,其中包含我的博客文章的關鍵字。

假設$ keyword包含每個文章的技術,技術,娛樂性各不相同。

如何使用php查詢$ keyword,以便在頁面加載時僅顯示包含關鍵字“ tech”的文章。

我可以使用LIMIT還是應該使用SELECT函數?

先感謝您。

使用“喜歡”求值器可使您將值字段與部分字符串匹配。 在這種情況下, %充當通配符,因此%tech%匹配所有包含'tech'的查詢:

mysql_query("select * from news where keyword like '%tech%' limit lowervalue, highervalue");

mysql_query("select * from news where keyword like '%tech%' limit 5");

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM