1. [代码][PHP]代码
include "linkdb.php";
header("Content-type:text/html;charset=utf-8");
$word=$_GET["word"];
$search=$_GET["searc"];
$sqlstr="SELECT * from word where word='".$word."'";
$rst=mysql_query($sqlstr);
list($word,$exp)=mysql_fetch_row($rst);
echo '
'.$word.'
'.$exp.'
';
if($word==''){
echo '
查无记录……
';
}
?>2. [代码][PHP]代码
/////////linkdb.php//////////
/////////link database///////
$mydb=mysql_pconnect('localhost','root','lijun');
mysql_query("SET NAMES 'utf8'");
if(!$mydb)
{
//echo "连结失败....";
}else{
//echo "连接成功....";
}
$db=mysql_select_db('mydatautf8',$mydb);
if($db){
//echo "数据库连接正确...";
}else{
//echo "数据库连结错误....";
}
?>3. [文件] dicsug.php
///////////词典suggest响应页面/////////////
include "linkdb.php";
header("Content-type:text/html;charset=gb2312");
$word=$_GET["word"];
$sqlstr="SELECT word from word where word like '".$word."%'";
$rst=mysql_query($sqlstr);
$i=0;
$w['0']='';
$w['1']='';
$w['2']='';
$w['3']='';
$w['4']='';
$w['5']='';
$w['6']='';
$w['7']='';
$w['8']='';
$w['9']='';
while(($row=mysql_fetch_row($rst))&&$i<=9){
list($w[''.$i.''])=mysql_fetch_row($rst);
$i++;
}
echo $w["0"].' '.$w["1"].' '.$w["2"].' '.$w["3"].' '.$w["4"].' '.$w["5"].' '.$w["6"].' '.$w["7"].' '.$w["8"].' '.$w["9"];
?>4. [代码][PHP]代码
四级查词
5. [图片] printscreen1.png
立即学习“PHP免费学习笔记(深入)”;











