<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>在线词典</title>

<link href="shouye.css" rel="stylesheet" type="text/css" />

</head>

<body>

<div class="toubu"><h1>在线词典精彩无限</h1></div>

<div class="zhongjian"><img src="1.jpg"/>

<H1>查询英文</H1>

<form action="wordprocess.php" method="post" >

请输入英文:<input name="enword" type="text" />

<input name="type" type="hidden" value="search1" />

<input  type="submit" value="查询" />

</form>

<H1>查询中文</H1>

<form action="wordprocess.php" method="post" >

请输入中文:<input name="chword" type="text" />

<input name="type" type="hidden" value="search2" />

<input  type="submit" value="查询" />

</form></div>

<div class="zuihou">

  <div>山东省邵氏科技股份有限公司</div>

  <div class="zuihou">地址:山东省济南市山大北路。技术支持:邵先生   邮箱: </div>

 

</div>

</body>

</html>

@charset "utf-8";

.zuihou {

 font-family: "Comic Sans MS", cursive;

 font-size: 15px;

 text-align: center;

 background-color: #CCC;

 float: left;

 height: 20%;

 width: 100%;

}

.toubu{

 font-size: 24px;

 text-align: center;

 background-color: #CCC;

 float: left;

 height: 20%;

 width: 100%;

 font-family: Verdana, Geneva, sans-serif;

}

.zhongjian {

 position: relative;

 text-align: center;

 border: thin solid silver;

 width: 950px;

 height: inherit;

 background-color: #FF9;

 margin: auto;

 padding: 1px;

 background-position: center;

 clear: both;

 float: none;

 

}

<?Php

header("Content-type:text/html;charset=utf-8");//设置浏览器显示的乱码问题

require_once("412.php");

if(isset($_POST['type'])){

 $type=$_POST['type'];

}else{

 echo"输入为空";

 echo"<a href='mainview.php'>返回又一次查询</a>";

}

if($type=="search1"){

//接受英文单词

if(isset($_POST['enword'])){$en_word=$_POST['enword'];}else{//主义 $_POST 函数是分大写和小写的

 echo"输入为空";

 echo"<a href='mainview.php'>返回又一次查询</a>";

 }

//看看数据库中有没有这条记录

$sql="select  chword from words where enword='".$en_word."' limit 0,1";

 

  $sqltool=new sqltool();

 

  $res=$sqltool->execute_dql($sql);

  if($row=mysql_fetch_assoc($res)){//主义:此处用的是关联数组

   echo $en_word."相应的中文意思是:  ".$row['chword'];

   echo"<br /><a href='mainview.php'>返回又一次查询</a>";}

   else{

    echo"查询没有这个词条";

    echo"<br /><a href='mainview.php'>返回又一次查询</a>";}

mysql_free_result($res);

}

if($type=="search2"){

//接受中文

if(isset($_POST['chword'])){$ch_word=$_POST['chword'];}else{//主义 $_POST 函数是分大写和小写的

 echo"输入为空";

 echo"<a href='mainview.php'>返回又一次查询</a>";

 }

//看看数据库中有没有这条记录

$sql="select  enword from words where chword like '%".$ch_word."%'";

 

  $sqltool=new sqltool();

 

  $res=$sqltool->execute_dql($sql);

  if(mysql_num_rows($res)){

  while($row=mysql_fetch_assoc($res)){//主义:此处用的是关联数组

   echo $ch_word.'相应的意思是:  '.$row['enword'];

   echo"<br />";

  }

   echo"<br /><a href='mainview.php'>返回又一次查询</a>";}

  else{

 

    echo"查询没有这个词条";

    echo"<br /><a href='mainview.php'>返回又一次查询</a>";}

mysql_free_result($res);

}

?>

<?php //412.php

class sqltool{

 private $conn;

 private $host="localhost";

 private $user="root";

 private $password="";

 private $db="worddb";

 

 function sqltool(){

  $this->conn=mysql_connect($this->host,$this->user,$this->password);

  if(!$this->conn){

   die("链接数据库失败".mysql_error());

  }

  mysql_select_db($this->db,$this->conn)or die(mysql_error());

  mysql_query("set names utf8");

  

 }

 function execute_dql($sql){

  $res=mysql_query($sql);

  return $res;

 }

 function execute_dml($sql){

  $b=mysql_query($sql,$this->conn);

  if(!$b){

   return 0;

  }

  else{

   if(mysql_affected_rows($this->conn)>0){

    return 1;}

    else{

     return 2;

    }

  }

 mysql_close($conn);}

}

?>

在线词典php的更多相关文章

  1. ubuntu安装goldendict以及添加本地词典和在线词典

    软件在ubuntu软件中心安装就可以了, 关于网络词典, 推荐有道在线词典,网址http://dict.youdao.com/search?q=%GDWORD%&ue=utf8 添加方法:编辑 ...

  2. 终于知道linux firefox不能播放 web在线词典的单词发音了! --通过banshee安装gstreamer1-libav/-plugins-ugly/plugins-bad三个mp3插件.

    mpg123 是一个 命令行的播放器, 他没有gui界面. 直接用 mpg123 test.mp3 就可以直接播放, 而且, 最终要的是, mpg123 自带了mp3的解码器. mpeg: movin ...

  3. mysql扩展库应用---在线词典程序范例

    1,在mysql中创建数据表words. create table words( id int primary key not null auto_increment, enword varchar( ...

  4. WP8.1简单项目 《在线词典》

    为什么要做这个词典? 学了正则表达式要运用 增加WP开发熟练度 项目中运用了那些技术? HttpClient 正则表达式 数据绑定 详解 通过http://cn.bing.com/dict/searc ...

  5. 自己在使用的English词典

    一.ESL/非母语词典 二.EFL/母语词典 1.American Heritage Dictionary 2.World Book Dictionary 3.Oxford Dictionary of ...

  6. 有道词典 纯净版 - imsoft.cnblogs

    软件名称:有道词典软件版本:5.4 正式版(5.4.46.5554)软件主页:http://cidian.youdao.com/软件定制:飞扬时空更新日期:2013年8月26日 软件简介: 有道词典是 ...

  7. Linux安装多功能词典GoldenDict

    Linux安装多功能词典GoldenDict 活腿肠 2017.08.01 20:52* 字数 671 阅读 1555评论 0喜欢 2 Goldendict 简介 GoldenDict是一种开源的辞典 ...

  8. 侣行APP

    本次要做的是团队共同完成一个项目.由队长组织,全体队员一起讨论分析并完成一款APP的需求调研,分析等工作. 1.团队介绍 队长:杨晓帅 队员                               ...

  9. 关于编程一些鲜为人知的真相 csdn

    <关于编程一些鲜为人知的真相>一文讲了一些编程的真相:如果把所有项目的生命周期平均一下,那么一个程序员大概10-20%的时间用来写代码,并且大多数程序员可能每天大约只有10-12行代码会进 ...

随机推荐

  1. Linux Syslog

    http://blog.chinaunix.net/uid-677314-id-164215.html http://blog.chinaunix.net/uid-24708340-id-397132 ...

  2. 目前常用AD/DA芯片简介

    目前生产AD/DA的主要厂家有ADI.TI.BB.PHILIP.MOTOROLA等,武汉力源公司拥有多年从事电子产品的经验和雄厚的技术力量支持,已取得排名世界前列的模拟IC生产厂家ADI.TI公司代理 ...

  3. [置顶] CSDN博客第三期云计算最佳博主评选

    CSDN博客第二期云计算最佳博主排行圆满结束,恭喜所有上榜用户,为继续展示云计算方向的优秀博主,发掘潜力新星,为云计算方向的博客用户提供平台,CSDN博客第三期云计算最佳博主排行开始.同时,获奖者有机 ...

  4. CentOS Linux 语言环境设置

    程序运行使用一套语言需要有字符集(数据)和字体(显示),Locale是根据计算机用户所使用的语言,所在国家或者地区,以及当地的文化传统所定义的一个软件运行时的语言环境. 一.locale详解 在 Li ...

  5. Jupyter Notebook通过latex输出pdf

    主要步骤 1.将ipynb编译成tex ipython nbconvert --to latex Example.ipynb 2. 修改tex,增加中文支持 在\documentclass{artic ...

  6. 网易云课堂_程序设计入门-C语言_第四周:循环控制_2念整数

    2 念整数(5分) 题目内容: 你的程序要读入一个整数,范围是[-100000,100000].然后,用汉语拼音将这个整数的每一位输出出来. 如输入1234,则输出: yi er san si 注意, ...

  7. navigationController显示隐藏问题

    今天遇到设置: self.navigationController.navigationBarHidden= YES; 点击返回上一个UIViewController的时候这个时候这个navigati ...

  8. Mvc里查询商品页面

    /// <summary> /// 商品小类筛选页面 GoodsTypeName ----------------SelectGoods--商品筛选 --图文 /// Home/Selec ...

  9. 自学php的几个例子(包含AMP(Apache、MySQL、PHP)环境搭建链接)

    学习PHP之前需要先搭建PHP运行的环境(即服务器+PHP+数据库)来使PHP成功运行,具体环境搭建教程可参考pharen(http://www.cnblogs.com/pharen/archive/ ...

  10. util 学习

    const I = 3.4893589; console.log(Number.parseInt(I)); console.log(Number.parseFloat(I)); console.log ...