2010年1月11日 星期一

記憶碎片第六片-php 關鍵字搜尋

搜尋
$query_RecNews = sprintf("SELECT * FROM news WHERE news_subject LIKE %s AND news_active = 1 ORDER BY news_date DESC", GetSQLValueString("%" . $colname_RecNews . "%", "text"));

LIKE %s 然後 用GetSQLValueString("%" . $colname_RecNews . "%", "text"));//兩個%符號夾中間

可模糊搜尋到只要有 包含關鍵字就出來

沒有留言:

張貼留言