多重件合查(一)

平常我在系,一定不缺少查弁?然而往往算件是法足用的要求的,我就置多重件行合,用查以更加方便地查件,迅速找到他所足的.在我假一表公司的客系,有客,,名,量,价格等料,里就不料一一列,.表如下:(ID)
(TYPE)名(NAME)量(QTY) 价格(PRICE)001 机芯 机芯1 100 150001 表 表1 1000
60001 表 表1 500 70002 机芯 机芯2 200 40002 表 表2 300 53002表 表2 400
46在我想要建一查系,用即可根据,也可根据,或者根据价格,或者其中的各自合快速查,代如下:下面此部分是示查件的窗体html?$linkstr=mysql_connect(localhost,root,sa);mysql_select_db(cx,$linkstr);?script
language=JavaScriptfunction variable(){if
(document.search.select1.value!=1){if
(document.search.no.value==){window.alert(入!);return false;}else{if
(document.search.type.value==){window.alert(配件!);return
false;}}}else{if (document.search.select2.value!=1){if
(document.search.price.value==){window.alert(入价格!);return
false;}}}}/scriptbrcenterfont size=5b多重件合查/b/font/centerbrbodyform
action=searchjg.php method=POST name=search onsubmit=return
variable(this.value)table align=center border=1 width=400trtd align=left
width=100/tdtd align=left width=300input type=text name=no/td/trtrtd
align=left width=200select name=select1option selected value=1option
value=2或者option value=3而且/select/tdtd align=left width=200select
name=typeoption selected?$querystring=select distinct type from orders
;$result=mysql_query($querystring,$linkstr);while
(list($type)=mysql_fetch_row($result)){echo option
value=$type.$type;}?/select/trtrtdselect name=select2option selected
value=1option value=2或者option value=3而且/select价格位在/tdtdselect
name=priceoption selectedoption value=150以下option value=250~200?option
value=3200以上/select的配件/td/trtable width=400 align=righttrtdinput
type=submit name=submit value=始查/td/tr/table/table/form/body/html

###############index.php######################
?session_start(); require./inc/func.php; mscon(); require
./inc/header.inc; ? script language=javascript function opwin(filename)
{window.open(read_article.php?id=+filename,,height=500,width=585,resizable=no,scrollbars=yes,status=no,toolbar=no,menubar=no,location=no);
} /script /head body bgcolor=#FFFFFF text=#000000 leftmargin=0
topmargin=0 table width=100% border=0 cellspacing=0 cellpadding=0
bgcolor=#003399 height=23 tr td width=80 div id=Layer2
style=position:absolute; left:7px; top:17px; width:43px; height:44px;
z-index:2object classid=clsid:D27CDB6E-AE6D-11cf-96B8-444553540000
codebase=#version=5,0,0,0 width=80 height=60 param name=movie
value=images/logo.swf param name=quality value=high param name=wmode
value=transparent embed src=images/logo.swf quality=high
pluginspage=_Prod_Version=ShockwaveFlash
type=application/x-shockwave-flash width=80 height=60 wmode=transparent
/embed /object/div div id=Layer1 style=position:absolute; left:-5px;
top:61px; width:49px; height:37px; z-index:1img src=images/11.gif
width=58 height=55/div /td td width=539 object
classid=clsid:D27CDB6E-AE6D-11cf-96B8-444553540000
codebase=#version=5,0,0,0 width=468 height=60 param name=movie
value=images/ti1.swf param name=quality value=high param name=wmode
value=transparent embed src=images/ti1.swf quality=high
pluginspage=_Prod_Version=ShockwaveFlash
type=application/x-shockwave-flash width=468 height=60 wmode=transparent
/embed /object /td /tr /table table width=100% border=0 cellspacing=0
cellpadding=0 tr td background=images/211.gif height=2/td /tr /table
tableFORM name=form1 action=search.phpmethod=post target=_blank table
width=80% border=0 cellspacing=0 cellpadding=0 bgcolor=#009933
align=center tr td align=center input type=text name=key select
name=type option value=全部类别/option ? $typ=file(list.txt);
$num=count($typ); for($i=2;$i=$num;$i++) { echooption
value=$typ[$i]$typ[$i]/option;} ? /select select name=whe option
value=全部内容/option option value=1文章内容/option option
value=2文章标题/option option value=3加入时间/option /select input
type=hidden name=submit value=1 input type=submit name=submit
value=提交查询 /td /tr /table /FORM/table ? $type=trim($type); if($comm)
{ $sec=and comm=1; $fir=where comm=1; } if(!empty($type)) $query=select
count(*) from $table where type=’$type’ $sec; else $query=select
count(*) from $table $fir; $res=mysql_db_query($database,$query);
if(@mysql_num_rows($res)0) $tot=mysql_fetch_array($res);
$total=$tot[0]; $total_page=ceil($total/$pagenum); echo table
width=80% border=0 cellspacing=0 cellpadding=0 ; echo
trtd共:.$total.篇.$total_page.页/td/tr; if(empty($page)) $page=0;
if(empty($offset)) $offset=0; $offset=$pagenum*$page; if(!empty($type))
$query=select * from $table where type=’$type’ $sec order by id desc
limit $offset,$pagenum; else $query=select * from $table $fir order by
id desc limit $offset,$pagenum; $res=mysql_db_query($database,$query);
if(@mysql_num_rows($res)0) while($topic=mysql_fetch_array($res)) {
if(strlen($topic[title])40) {
$topic[title]=substr($topic[title],0,40) ;
$topic[title]=$topic[title]……; }
if(trim($topic[time])==date(Y年m月d日)) $topic[time]=font
color=#FF9900$topic[time]/font; echo trtd[$topic[type]]a href=#
onClick=opwin($topic[id]);$topic[title]/afont
size=1($topic[time])/font; if($topic[comm]==1) echo img
src=./images/comm.gif alt=精品文章; if($topic[locked]==1) echo img
src=./images/locked.gif alt=文章已锁定; echo /td td阅读:$topic[hits]
次;评论:$topic[p_num]次/td /tr; } else echo 对不起,本栏
目暂没有任何文章!!!; echo /table; ? br table width=80% border=0
cellspacing=0 cellpadding=0 align=center tr td ? $pre=$page-1;
$next=$page+1; if($page0) echo a
href=$php_self?page=$pre&type=$type/abrbr; else echo brbr;?/td
td?if($page$total_page-1) echo a
href=$php_self?page=$next&type=$type/abrbr; else echo brbr;?/td td form
跳转到: select name=page onchange=top.location=’? echo
$php_self;??page=’+document.forms[1].elements[0].value+’&type=?echo
$type;?’; class=border ? for($i=0;$i$total_page;$i++) { $p=$i+1; echo
option value=$i; if($page==$i) echo selected ; echo 第.$p.页/optionn; }
? /select /form /td td form 选择栏目: select
name=typeonchange=top.location=’? echo
$php_self;??type=’+document.forms[2].elements[0].value?if($comm)
echo+’&comm=1′;?; ? $typ=file(list.txt); $num=count($typ);
for($i=0;$i$num;$i++) { echooption value=$typ[$i] ;
if(trim($typ[$i])==$type) {echo selected; } echo $typ[$i]/option;} ?
/select /form /tdtdform method=post action=? echo
$PHP_SELF;??type=?echo $type;? target=_balnkinput type=submit
name=comm value=精品文章 class=border/form/td /tr /table ?require
./inc/footer.inc;?
#####################read_article.php#########################
? require./inc/func.php; if(!$id) { echoscriptwindow.close();/script;
exit(); } mscon(); $query=select * from $table where id=’$id’;
$res=mysql_db_query($database,$query); if(!$res) { echo this article
has been deleted or no this article!!; exit(); }
$data=mysql_fetch_array($res); add_hits($data[id]);
$pre=$data[id]-1; $next=$data[id]+1; ? HTML HEAD TITLE ?echo
$data[title]–[$data[type]];? /TITLE META content=text/html;
charset=gb2312 style type=text/css !– body,table,td,input,textarea
{font-family: 宋体; font-size: 9pt} select {font-family: 宋体;
font-size: 9pt} code {font-family: Courier ; font-size: 10pt} a {color:
#005500} a:hover {color: #CC0000} .border {border: 1px #000000 solid;
background-color:transparent; list-style-position: inside;
list-style-type: square} — /style script language=javascript function
name() { var theResult = true; var elem4 = null; if
(document.forms[0].elements[0].value == ||
document.forms[0].elements[0].value == undefined ||
document.forms[0].elements[0].value == null) { elem4 =
prompt(请输入您的姓名:,); theResult = false;
document.forms[0].elements[0].value = elem4; } return theResult; }
function mail() { var theResult = true; var elem1 = null if
((document.forms[0].elements[1].value.indexOf(‘@’) == -1 ||
document.forms[0].elements[1].value == ||
document.forms[0].elements[1].value.indexOf(‘.’) == -1)) { elem1 =
prompt(请输入您的正确的电子邮件地址。谢谢!!,); theResult = false;
document.forms[0].elements[1].value = elem1; } return theResult; }
function go() { var theResult=true; theResult = name()&&mail(); return
theResult; } /script /HEAD BODY text=#000000 bgColor=#ffffff TABLE
borderColor=#339933 cellSpacing=0 borderColorDark=#ffffff
cellPadding=0 borderColorLight=#000000 border=1 width=545 TBODY TR
vAlign=center bgColor=#009900 TD background=images/third-back3.gif
TABLE cellSpacing=0 cellPadding=0 width=100% border=0 TBODY TR TD
width=17/TD TD width=590 TABLE width=36% border=0 TBODY TR TD
bgcolor=#009900 DIV FONT face=Verdana, Arial, Helvetica, sans-serif
color=#ffffffb ? echo $data[title];? /b/FONT/DIV
/TD/TR/TBODY/TABLE/TD TD width=19 DIV A
href=javascript:window.close()IMG height=17 src=images/third-close.gif
width=17 align=absMiddle border=0 name=content_r03_c28/A/DIV
/TD/TR/TBODY/TABLE/TD/TR TR vAlign=center align=left bgColor=#cccccc TD
TABLE cellSpacing=0 cellPadding=0 border=0 align=center width=100% TBODY
TR TD DIV align=leftA class=whitetxt href=read_article.php?id=?
echo$pre;?img src=images/prethread.gif width=48 height=12 border=0/A/DIV
/TD TD DIV align=lefta class=whitetxt href=read_article.php?id=? echo
$next;?img src=images/nextthread.gif width=48 height=12 border=0/a/DIV
/TD TDIMG height=16 src=images/mail.gif width=16/TD TD class=myfontA
class=redtxt href=commend.php?id=? echo
$data[id]&title=$data[title];?推荐给朋友/A/TD TD 发表时间: ? echo
$data[time];? 阅读次数: ? echo $data[hits];? /TD TD /TD /TR /TBODY
/TABLE /TD/TR TR vAlign=top TD class=tenpt ? if($data[locked]0) { echo
img src=images/lock.gif对不起!本文已经被管理员锁定!; } else
if($data[html]==1) highlight_string($data[cont]); else echo
nl2br($data[cont]); ? /TD /TR /TBODY/TABLE table bordercolor=#339933
cellspacing=0 bordercolordark=#ffffff cellpadding=0
bordercolorlight=#000000 border=1 width=545 tbody TR bgColor=#cccccc
th DIV 发表评论/DIV /th /TR tr td form name=form1 method=post
action=ping.php onsubmit=return go() 您的姓名: input type=text name=name
class=border 您的电子邮件: input type=text name=mail size=20
class=border 仅站长可见:input type=checkbox name=pub value=? echo
$data[title];? input type=hidden name=p_id value=? echo $id;? br
发表评论: textarea name=cont rows=8 cols=85/textarea br br center input
type=submit name=Submit value=提交 class=border input type=reset
name=Submit2 value=重写 class=border /center/form /td /tr TR
bgColor=#cccccc th DIV 相关评论/DIV /th /TR tr td ?$query=select *
from $ping_tab where p_id=’$id’ order by time desc;
$res=mysql_db_query($database,$query); if(mysql_num_rows($res)0)
{$i=1; while($ping=mysql_fetch_array($res)) echo
评论人:$ping[name]电子邮件:$ping[mail]br.nl2br($ping[p_cont]).br时间:$ping[time]来自:$ping[ip]hr
size=1n ; } else echo 暂时没有本文章的相关评论!; ? /td /tr tr
bgcolor=#cccccc td div a href=javascript:window.close()关闭窗口/a/div
/td /tr /tbody /table ?require ./inc/footer.inc;?

1.guestbook.php html head script language=JavaScript !– !– var
hellotext=为了您的最佳浏览效果请您使用IE4.0以上的版本和800*600分辨率
var thetext= var started=false var step=0 var times=1 function
welcometext() { times– if (times==0) { if (started==false) { started =
true; window.status = hellotext; setTimeout(anim(),1); } thetext =
hellotext; } } function showstatustext(txt) { thetext = txt;
setTimeout(welcometext(),4000) times++ } function anim() { step++ if
(step==7) {step=1} if (step==1) {window.status=’===’+thetext+’===’} if
(step==2) {window.status=’===’+thetext+’===’} if (step==3)
{window.status=’==’+thetext+’==’} if (step==4)
{window.status=’==’+thetext+’==’} if (step==5)
{window.status=’===’+thetext+’===’} if (step==6)
{window.status=’===’+thetext+’===’} setTimeout(anim(),200); } // —
welcometext(); function MM_jumpMenu(targ,selObj,restore){ //v3.0
eval(targ+.location=’+selObj.options[selObj.selectedIndex].value+’);
if (restore) selObj.selectedIndex=0; } //– /script
title天地网络留言版/title meta content=text/html; charset=gb2312 /head
style type=text/css !– a:link {font-size: 9pt; color: #FFFFFF} —
/style body ? $PAGESIZE=5; $db=mysql_connect(localhost,root,);
mysql_select_db(lyanban,$db); $result=mysql_query(SELECT * FROM
message order by date desc,$db); $rowcount=mysql_num_rows($result);
$PAGES=CEIL($rowcount/$PAGESIZE); if($rowcount==0) {echo 目前没有留言!a
href=guestbook.htm欢迎您留言!/a;} if($rownum == ) { $rownum = 1; }
$AA=CEIL($rownum/5); $i=0 ; echo TABLE WIDTH=100%tddiv font size=2
color=#000000B共有留言:$rowcount 条共:$PAGES 页right现在是第 $AA
页/right/B/font/div/td; echo hr size=1 color=#ccccffwidth=75%; while
($myrow=mysql_fetch_array($result)){ $i++;
if(($i=$rownum)&&($i$rownum+5)){ echo table width=75% border=1
cellspacing=0 cellpadding=0 bordercolordark=#FFFFFF
bordercolorlight=#000000 background=15.JPG; echo trtd width=15%div font
size=2 color=#FFFFFF姓 名/font/div/tdtd width=85%font size=2
color=#FFFFFF$myrow[username]/font/td/tr; echo trtd width=15%div font
size=2 color=#FFFFFF电子信箱/font/div/tdtd width=85%font size=2
color=#FFFFFFa href=mailto:$myrow[email]$myrow[email]/font/a/td/tr;
echo trtd width=15%div font size=2 color=#FFFFFF公司主页/font/div/tdtd
width=85%font size=2 color=#FFFFFFa href=$myrow[homepage]
target=_blank$myrow[homepage]/font/a/td/tr; echo trtd width=15%div
font size=2 color=#FFFFFF留言主题/font/div/tdtd width=85%font size=2
color=#FFFFFF$myrow[topic]/font/td/tr; echo trtd width=15%div font
size=2 color=#FFFFFF留言内容/font/div/tdtd width=85%font size=2
color=#FFFFFF$myrow[content]/font/td/tr; echo trtd width=15%div font
size=2 color=#FFFFFF留言时间/font/div/tdtd width=85%font size=2
color=#FFFFFF$myrow[date]/font/td/tr; echo /tablehr size=1
color=#ccccffwidth=75%;} } echo table width=100%trtd width=87%;
#判断是否有或 echo form name=hiddenform method=post
action=guestbook.php; echo div input type=hidden name=rownum value=;
echo input type=hidden name=rowcount value=$rowcount; #显示 if
($rownum=5) echo input type=submit value=
onclick=document.hiddenform.rownum.value=.($rownum-5).; #显示 if
($rownum+5=$rowcount) { echo input type=submit value=
onclick=document.hiddenform.rownum.value=.($rownum+5)./div; } echo
/form; echo /td; echo /tr; echo /table; echo table width=100% trtddiv
font color=#ffffff size=2a
href=guestbook.htm返回继续发言/a/font/div/td/tr/table; ? /body /html
2.show.php3 ? $username = htmlspecialchars(ltrim(stripslashes
(trim($name))));//本函式可去掉字串中的反斜线空格字元 $email =
htmlspecialchars(ltrim(stripslashes (trim($email)))); $homepage =
htmlspecialchars(ltrim(stripslashes (trim($homepage)))); $topic =
htmlspecialchars(ltrim(stripslashes (trim($topic)))); $content =
htmlspecialchars(ltrim(stripslashes (trim($content)))); //
$content=base64_encode($content); //send email //if ($ok)
mail($email,$topic,$content); if
(($username==)or($topic==)or(strlen($username)20)or(strlen($topic)20))
{echo 请填写必要的项目或着非法用户名!a
href=javascript:history.go(-1);返回/a; } //wrong email ? elseif
(($email!=)and(!eregi(^[_.0-9a-z-]+@([0-9a-z][0-9a-z-]+.)+[a-z]{2,3}$,$email)))
{ echo 请您填写正确的 E-Mail 地址/pp a
href=javascript:history.go(-1);返回/a; } //wrong homepage ? elseif
(($homepage!=)and(!eregi(()+[0-9a-z-]+.([0-9a-z-]+.)+[a-z]{2,3}$,$homepage)))
{echo 主页地址输入错误!a href=javascript:history.go(-1);返回/a;} else{
//联接数据库 mysql_connect(localhost,root,);
mysql_select_db(lyanban); $sql=select password from tb where
username=’$username’; $result=mysql_query($sql);
$nums=mysql_num_rows($result); if($nums!=1){ echo对不起!请先a
href=register.html注册/a!; } else{ //得到日期 YYYY-MM-DD HH:MM:SS
2000-01-01 00:00:00′ $t = date(Y.-.m.-.d. .H.:.i.:.s);
//将新用户插入数据库 mysql_query(insert into message values
(‘$username’,’$email’,’$homepage’,’$topic’,’$content’,’$t’)); echo div
font size=2 color=#000000谢谢您留言!您的留言已成功加入,a
href=guestbook.php返回/a/font/div; } } ? 3.zhuc.php(注册程序) ?
mysql_connect(localhost,root,) or die(无法连接数据库,请重试);
mysql_select_db(lyanban) or die(无法选择数据库,请重试); $query=select
password from tb where username=’$username’;
$result=mysql_query($query); $numrows=mysql_num_rows($result);
if($numrows!=0) {echo ‘已有人注册此名,请重新选择名字!a
href=javascript:history.go(-1);返回/a’;} else {$query=insert into
tb(username,password) values(‘$username’,’$password’);
mysql_query($query); echo ‘注册成功’; echo ‘A HREF=guestbook.htm
请登录!/A’;} ? 以下是两个配套的HTML: 1。留言网页 html head meta
content=text/html; charset=gb2312 meta name=GENERATOR content=Microsoft
FrontPage 4.0 meta name=ProgId content=FrontPage.Editor.Document
title天地网络留言版欢迎您留言!/title /head body bgcolor=#FFFFFF div
align=center center br font size=2天地网络留言版测试版/fontbr br form
method=post action=show.php3 table width=66% tr td width=50% height=1
div align=center font size=2 您的尊姓大名:/font/div /td td width=50%
height=1 div align=center input type=text name=name size=20 /div /td /tr
tr td width=50% height=1 div align=centerfont size=2
您的电子邮件地址:/font/div /td td width=50% height=1 div align=center
input type=text name=email size=20 /div /td /tr tr td width=50% height=1
div align=centerfont size=2 您的公司主页地址:/font/div /td td width=50%
height=1 div align=center input type=text name=homepage size=20 value=
/div /td /tr tr td width=50% height=1 div align=center font
size=2留言主题:/font/div /td td width=50% height=1 valign=middle div
align=center input type=text name=topic size=20 /div /td /tr tr td
width=50% height=1 div align=center font size=2留言内容:/font/div /td
td width=50% height=1 div align=center /div /td /tr tr td width=100%
colspan=2 height=66 p align=center textarea rows=10 name=content
cols=50/textarea /p /td /tr tr td width=50% height=18 div
align=center/div /td td width=50% height=18 div align=center/div /td /tr
tr td width=50% height=18 align=center p align=center input type=submit
value=发表留言 name=B1 /p /td td width=50% height=18 align=center div
align=center input type=reset value=全部重写 name=B2 /div /td /tr /table
/form /center /div p /p p /p /body /html 2.注册程序 html head
titleregiste/title meta content=text/html; charset=gb2312 /head body
bgcolor=#FFFFFF div align=center p/p p/p p用户注册/p form method=post
action=zhuc.php p用户名: input type=text name=username /p p密码: input
type=password name=password /p p input type=submit name=Submit
value=确定 input type=reset name=Submit2 value=重来 /p /form p/p /div
/body /html 如需要ZIP文件可给我来信。tandinet@163.net

You can leave a response, or trackback from your own site.

Leave a Reply

网站地图xml地图