把谁做为判断条件显示的时候谁就出错

phpkunpeng 2005-09-14 04:51:26
<?php
include("../conn.php");
require("../mylib.inc.php");
authorize() ;

$ipadd = $_SERVER["REMOTE_ADDR"];
//echo $ipadd.$status;
if(($status<3)&&($ipadd!="218.247.170.214"))
err_exit("您只能在公司工作");

include("../page.class.php");

if($status<2)
err_exit("没权限或者登陆超时");

$condition = " id>0 ";
//选定gateway
if (($_REQUEST["gateway"])!="")
{ $gateway = $_REQUEST["gateway"];
$condition .= " and gateway='$gateway'";
}
//选定pingtai
if (($_REQUEST["pingtai"])!="")
{ $pingtai = $_REQUEST["pingtai"];
$condition .= " and pingtai='$pingtai'";
}

$sqlnum = "select count(*) from cr_xinrui_phone where ".$condition ;
$resultnum = mysql_query($sqlnum) or die("Query failed : " . mysql_error());
$rnum = mysql_fetch_array($resultnum);
$talnum = $runm[0];
$page = new ShowPage;
$page->PageSize = 30;
$page->Total = $talnum;
$page->LinkAry = array();

$sql = "select * from cr_xinrui_phone where ".$condition." order by gateway desc limit ".$page->OffSet();
$result = mysql_query($sql) or die("Query failed : " . mysql_error());
$num = mysql_num_rows($result);
if ($num == 0)
echo ("暂时没有记录");
for ($i=0;$i<$num;$i++)
{
$r = mysql_fetch_array($result);
$id[$i] = $r["id"];
$telarea[$i] = $r["telarea"];
$telnumber[$i] = $r["telnumber"];
$gateway[$i] = $r["gateway"];
$pingtai[$i] = $r["pingtai"];
$telpw[$i] = $r["telpw"];
$telstatus[$i] = $r["status"];
$tel[$i] = $telarea[$i].$telnumber[$i];
}

if (isset($del))
{
$sql="delete from cr_xinrui_phone where id='".$del."'";
$rs=mysql_query($sql);
echo "<script>location.replace('list.php');</script>";
}
?>
<link href="../css/wfabm.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
--></style>
<style type="text/css">
<!--
body {
background-color: #EEF2FB;
background-image: url();
}
.style1 {
color: #003366;
font-weight: bold;
}
-->
</style>
<script>
function del(id){
location.replace('list.php?del='+id);
}
</script>
<table width="100%" border="0">
<tr bgcolor="#CCCCCC">
<td>号码</td>
<td>网关</td>
<td>平台</td>
<td>密码</td>
<td>状态</td>
<td>操作</td>
</tr>
<?php
for ($i=0;$i<$num;$i++)
{
?>
<tr>
<td><?php echo $tel[$i]; ?></td>
<td><?php echo $gateway[$i]; ?></td>
<td><?php echo $pingtai[$i]; ?></td>
<td><?php echo $telpw[$i]; ?></td>
<td><?php echo $telstatus[$i]; ?></td>
<td><?php echo "<a href=javascript:del('$id[$i]') class=title>删除</a>"; ?>
  <a href="insert.php?id=<?php echo $id[$i]; ?>">修改</a>
</td>
</tr>
<?php
}
?>
<form name="form1" method="post" action="">
<tr bgcolor="#CCCCCC">
<td colspan="1"><a href="insert.php"><strong>新号码添加</strong></a>
</td>
<td colspan="5">网关:
<select name="gateway">
<option></option>
<option value="北京">北京</option>
<option value="上海">上海</option>
<option value="山东">山东</option>
</select>
   平台:
<select name="pingtai">
<option></option>
<option value="SD_huawei">山东华为</option>
<option value="SD_zhongxing">山东中兴</option>
<option value="SD_langxun">山东朗讯</option>
</select>
<input type="submit" name="Submit" value="提交">
</td>
</tr>
</form>
<tr>
<td colspan="6" align="right"><?php
$showpage = $page->ShowLink();
echo $showpage ;
?>
</td>
</table>
...全文
94 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
phpkunpeng 2005-10-13
  • 打赏
  • 举报
回复
可能是汉字问题,谢谢wxq4100798(aa) 和yunfeifan
wxq4100798 2005-09-15
  • 打赏
  • 举报
回复
估计应该是汉字截取问题
yunfeifan 2005-09-15
  • 打赏
  • 举报
回复
看看你的数据库中gateway 字段是否出现了半个汉字的情况,因为这样可能半个汉字把</td>的<吃掉了。如果不行,建议你的gateway用urlencode的方式编码,只要出现汉字,就编码,应该没有什么问题。
phpkunpeng 2005-09-15
  • 打赏
  • 举报
回复
是不是我说的意思不明白还是 没人遇见过类似的问题 help
phpkunpeng 2005-09-14
  • 打赏
  • 举报
回复
比如我把gateway作为sql的条件 选择了 北京 结果显示出来的内容 该显 "北京" 的都显示 "?/td> "
有好多类似问题做不好 高手给指点指点吧

21,891

社区成员

发帖
与我相关
我的任务
社区描述
从PHP安装配置,PHP入门,PHP基础到PHP应用
社区管理员
  • 基础编程社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧