{"id":410,"date":"2012-02-06T11:09:57","date_gmt":"2012-02-06T03:09:57","guid":{"rendered":"http:\/\/www.youthtribe.com\/?p=410"},"modified":"2012-02-06T11:11:15","modified_gmt":"2012-02-06T03:11:15","slug":"%e4%b8%bagif-nbqq-net%e6%90%9e%e7%ac%91%e5%9b%be%e7%89%87%e7%ab%99%e5%81%9a%e4%b8%80%e4%b8%aa%e6%90%9c%e7%b4%a2%e8%ae%b0%e5%bd%95%e5%86%85%e5%ae%b9%e5%b1%95%e7%a4%ba%e7%9a%84%e6%a8%a1%e5%9d%97","status":"publish","type":"post","link":"http:\/\/www.youthtribe.com\/archives\/410","title":{"rendered":"\u4e3agif.nbqq.net\u641e\u7b11\u56fe\u7247\u7ad9\u505a\u4e00\u4e2a\u641c\u7d22\u8bb0\u5f55\u5185\u5bb9\u5c55\u793a\u7684\u6a21\u5757"},"content":{"rendered":"
\u5199\u8fd9\u4e2a\u6a21\u5757\u7684\u76ee\u7684\u662f\u8bb0\u5f55\u4e0b\u8bbf\u5ba2\u5728\u672c\u7ad9\u7684\u641c\u7d22\u8bb0\u5f55\uff0c\u7136\u540e\u518d\u5c55\u793a\u51fa\u6765\uff0c\u5f53\u7136\u8fd8\u662f\u642d\u914d\u54b1\u7684php+mysql \u4e86\u3002\u8fd9\u4e2a\u60f3\u6cd5\u662f\u6211\u5728\u5e74\u524d\u56de\u5bb6\u7684\u706b\u8f66\u4e0a\u9996\u9875\u51fa\u6765\u7684\u3002\u4e00\u6765\u53ef\u4ee5\u589e\u52a0\u6536\u5f55\uff0c\u4e8c\u6765\u663e\u5f97\u4e13\u4e1a\u4e0d\u662f\uff0c\u5475\u5475<\/p>\n
\u597d\u7684\uff0c\u5148\u6765\u770b\u4e0bsearch_history\u8868\u7ed3\u6784\uff1a<\/p>\n
3\u4e2a\u5b57\u6bb5\uff1aid(\u9012\u589e\uff09\uff0csearchword(\u641c\u7d22\u5185\u5bb9\uff0c\u4e0d\u80fd\u4e3a\u7a7a)\uff0caddtime\uff08\u8be5\u8bb0\u5f55\u6dfb\u52a0\u65f6\u95f4\uff09\u3002<\/p>\n
\u5efa\u8868php:<\/p>\n
<\/p>\n
$sql_cre_search_history=mysql_query(“CREATE TABLE IF NOT EXISTS `search_history` (
`id` int(100) NOT NULL auto_increment,
`searchword` varchar(20) CHARACTER SET utf-8 COLLATE utf-8_chinese_ci NOT NULL,
`addtime` datetime NOT NULL,<\/p>\n
PRIMARY KEY (`id`)
)”);<\/p>\n
\u521a\u767e\u5ea6\u4e86\u4e0b\uff0cvarchar 20\u662f\u4e0d\u8d85\u8fc710\u4e2a\u6c49\u5b57\u7684\u610f\u601d\u3002<\/p>\n
ok,\u56e0\u4e3a\u539f\u5148\u5df2\u6709\u4e00\u4e2asearch.php\u4e86\uff0c\u8fd9\u4e2a\u9875\u9762\u662f\u4e00\u4e2a\u7b80\u5355\u7684php\u67e5\u8be2\u9875\u9762\u3002\u73b0\u5728\u8981\u505a\u7684\u5c31\u662f\u5728\u6bcf\u4e00\u6b21\u641c\u7d22\u8bf7\u6c42\u53d1\u51fa\u65f6\uff0c\u53ea\u8981\u641c\u7d22\u5185\u5bb9\u4e0d\u4e3a\u7a7a\uff0c\u90a3\u4e48\u5c31\u628a\u8be5\u6761\u8bb0\u5f55\u5b58\u5728search_history\u8868\u91cc\u8fb9\u3002let’s go<\/p>\n
if($_POST[content]!=””){<\/p>\n
$sb=$_POST[content];
$searchword=trim($sb);\/\/\u53bb\u5b57\u7b26\u5de6\u53f3\u7a7a\u683c
mysql_query(“insert into search_history values (”,’$searchword’,now()”);} <\/p>\n
\u5728\u751f\u6210 \u8868\u65f6\u9047\u5230\u4e00\u4e2a\u8fd9\u6837\u7684\u95ee\u9898\uff1a\u751f\u6210\u7684\u65b0\u8868\u662futf8_general_ci\uff0c\u8001\u8868\u662f\uff1alatin1_swedish_ci\uff1f\uff1f\u6ca1\u65f6\u95f4\u641e\u4e86\uff0c\u5c31\u53bbphpmyadmin\u7ea0\u6b63\u8fc7\u6765\u4e86\uff0c\u4ee5\u540e\u518d\u8bf4\u8fd9\u4e2a\u95ee\u9898\u3002<\/p>\n
\u518d\u6765\u4e00\u4e2a\u663e\u793a\u6700\u8fd1\u641c\u7d22\u76845\u4e2a\u5173\u952e\u8bcd\u7684\u6a21\u5757\uff1a\u76f4\u63a5\u4e0aPHP\uff1a<\/p>\n
$result_latest_five=mysql_query(“select * from search_history order by id desc limit 5”);
while($rows_latest_five=mysql_fetch_array($result_altest_five)){ <\/p>\n
$data_latest_five[]=$rows_latest_five;
}<\/p>\n
\u8fd9\u6837\u5c31\u5728\u6570\u7ec4\uff1a$data_latest_five\u91cc\u4e86\u3002<\/p>\n