<!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. QTcpSocket 及 TCP粘包分析

    ----我的生活,我的点点滴滴!! 这两天用Qt简单的实现一个tcp多线程client,在此记录下知识. 一.长连接与短连接 1.长连接 Client方与Server方先建立通讯连接,连接建立后不断开 ...

  2. Delphi窗体最大化按钮不可用情况下的最大化

    最大化按钮不可用,而且窗体最大化,我以前一直这样设置:在Object Inspector下把BorderIcons属性下的biMaximize属性设置为False,然后把WindowState属性设置 ...

  3. cat监控平台环境搭建

    项目地址:https://github.com/dianping/cat 编译步骤: 这个项目比较另类,把编译需要的jar包,单独放在git分支mvn-repo里了,而且官方文档里给了一个错误的命令提 ...

  4. #include <string.h>

    1 _memccpy 2 _memicmp 3 _strlwr 4 _strrev 5 _strset 6 _strupr 7 memccpy 8 memchr 9 memcpy 10 memicmp ...

  5. C#下使用GDAL

    參考博客:http://blog.csdn.net/rrrrssss00/article/category/915498.以及viewmode=contents">李民录老师专栏.ht ...

  6. Effective C++笔记 55条编程法则

    1.  视C++为一个语言联邦 C++高效编程守则视状况而变化,取决于你使用C++的哪一部分. 2.  尽量以const,enum.inline替代#define 1) 对于单纯常量,最好以const ...

  7. Android dump .so 文件crash log

    众所周知,在android系统上,有时候我们遇到so文件的crash仅仅能打log,可是非常多时候并不知道crash在什么地方,幸运的是crash后,一般能够产生一个.dmp文件. 我们能够依据这个文 ...

  8. C#命名空间详解namespace

     命名空间是一个域,这在个域中所有的类型名字必须是唯一的,不同的类型分组归入到层次化的命名空间, 命名空间的好处是:1.避免名字冲突,2.便于查找类型名字. 如:System.secruity.Cry ...

  9. html系列教程--p param progress rp rt ruby script select small source

    <p> 标签:用户段落划分或折行的标签 <param> 标签:param 元素允许您为插入 XHTML 文档的对象规定 run-time 设置,也就是说,此标签可为包含它的 & ...

  10. C#委托,事件,匿名委托

    作为一个初学者,写下来是当做自己的学习笔记,希望在以后遇到问题的时候能够快速的找到方法 如果能帮助跟我一样的新人是更好不过的了        如果有什么不正确或者可以改进的地方也希望大家能够指出来  ...