| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1185 人关注过本帖
标题:[求助]看看错在哪了?
只看楼主 加入收藏
hadisi
Rank: 1
等 级:新手上路
帖 子:82
专家分:0
注 册:2006-5-15
收藏
 问题点数:0 回复次数:1 
[求助]看看错在哪了?

<?php
if ($_GET["action"] == "save")
{
$name = $_POST["name"];
$code = $_POST["code"];
$type = $_POST["type"];
$sid = $_POST["sid"];
include "mysql_data.php";
//mysql_connect($MySqlHost,$MySqluser,$MySqlPass);
//mysql_select_db($mysqldb);
$conn = mssql_connect($hostname,$dbuser,$dbpasswd) or die("Could not connect"); //连接MSSQL$db = mssql
$db = mssql_select_db($dbname); /*连接要访问的数据库 这里也可以写做 $db=mssql_select_db($dbname,$conn); */
if (! $db) {
die("不能连接到数据库!数据库不存在!");
}
$str = "select * from shop_area where name='$name' and code = '$code' and sid = '$sid'";
//echo $str;
//exit;
$result = mysql_query($str);
if ($list=mysql_fetch_object($result))
{
echo "<script> alert('同级内存在相同的地区名或编号');this.location.href='javascript:history.go(-1)';</script>";
}

else
{
mysql_connect($MySqlHost,$MySqluser,$MySqlPass);
mysql_select_db($mysqldb);
$str = "insert into shop_area (id,name,code,sid,gedate) values(1,'.$name.','.$code.','.$sid.',time())";
mysql_query($str);
echo "<script> alert('提交成功');this.location.href='javascript:history.go(-1)';</script>";
}

}
?>


<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>卖场区域</title>
<link href="../style/tableNormal.css" rel="stylesheet" type="text/css">
<script src="../javascript/htmlTools.js"></script>
</head>

<body>
<p>&nbsp;</p>
<form name="areaForm" method="post" action="?action=save">
<input type="hidden" name="sid" value="0">
<table width="96%" border="1" align="center" cellpadding="4" cellspacing="0" class="tableMain">
<tr>
<td colspan="3" class="tableTop"></td>
</tr>
<tr align="center">
<td colspan="3" class="title">新增区域</td>
</tr>
<tr>
<td width="63%" rowspan="4" valign="top">上级区域:
<!-- 地区列表Begin -->
<script>
var regEx = /(closeflag\.gif)$/gi;
function changeFlag(imgObject){
if(regEx.test(imgObject.src))
imgObject.src = "../images/openflag.gif";
else
imgObject.src = "../images/closeflag.gif";
}

function showTreeByDifferent(type){
areaForm.sid.value = 0;
if(areaForm.c1.length!=null)
for(var i=0; i<areaForm.c1.length; i++)
areaForm.c1[i].disabled = (type!="市级");
else
areaForm.c1.disabled = (type!="市级");

if(areaForm.c2.length!=null)
for(var i=0; i<areaForm.c2.length; i++)
areaForm.c2[i].disabled = (type!="区级");
else
areaForm.c2.disabled = (type!="区级")
}
</script>
<table width="96%" border="0" cellpadding="2" cellspacing="0">
<?php
$mysql = "select * from shop_area where type='省/直辖市' order by sid";

$result = mysql_query($mysql);

while ($row = mysql_fetch_row($result))
{
?>
<tr>
<td> <img src="../images/closeflag.gif" align="absmiddle" width="15" height="15" border="0" onClick="changeFlag(this);changeObjectDisplay(tableOf<?= $row[0] ?>, null)">
<input type="radio" name="c1" value="43" onClick="sid.value=this.value" disabled="true">
[<?=$row[2]?>]<?= $row[1]?>
<!-- 市级内容列表Begin -->
<table style="display:none " border="0" cellpadding="2" cellspacing="0" id="tableOf43">

<tr>
<td>&nbsp; <img src="../images/closeflag.gif" align="absmiddle" width="15" height="15" border="0" onClick="changeFlag(this);changeObjectDisplay(tableOf44, null)">
<input type="radio" name="c2" value="44" onClick="sid.value=this.value" disabled="true">
[BJ-BJ]北京
<!-- 区级内容列表Begin -->
<table style="display:none " border="0" cellpadding="2" cellspacing="0" id="tableOf44">

<tr>
<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="radio" value="45" disabled="true">
[BJ-BJ-A01][东城区]东四-隆福寺</td>
</tr>

<tr>
<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="radio" value="48" disabled="true">
[BJ-BJ-A03][东城区]安定门-交道口-南锣鼓巷</td>
</tr>

<tr>
<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="radio" value="47" disabled="true">
[BJ-BJ-A02][东城区]东直门</td>
</tr>

<tr>
<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="radio" value="49" disabled="true">
[BJ-BJ-A04][东城区]安贞桥-安华桥</td>
</tr>

<tr>
<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="radio" value="50" disabled="true">
[BJ-BJ-A05][东城区]雍和宫-国子监-北新桥</td>
</tr>

<tr>
<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="radio" value="51" disabled="true">
[BJ-BJ-A06][东城区]东四十条-张自忠路</td>
</tr>

<tr>
<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="radio" value="52" disabled="true">
[BJ-BJ-A07][东城区]地安门</td>
</tr>

<tr>
<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="radio" value="53" disabled="true">
[BJ-BJ-A08][东城区]美术馆-宽街</td>
</tr>

<tr>
<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="radio" value="54" disabled="true">
[BJ-BJ-A09][东城区]东单-王府井</td>
</tr>

<tr>
<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="radio" value="55" disabled="true">
[BJ-BJ-A10][东城区]鼓楼-烟袋斜街</td>
</tr>

<tr>
<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="radio" value="56" disabled="true">
[BJ-BJ-B01][西城区]西单</td>
</tr>

<tr>
<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="radio" value="57" disabled="true">
[BJ-BJ-B02][西城区]新街口</td>
</tr>

<tr>
<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="radio" value="58" disabled="true">
[BJ-BJ-B03][西城区]复兴门</td>
</tr>

<tr>
<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="radio" value="59" disabled="true">
[BJ-BJ-B04][西城区]阜成门</td>
</tr>

<tr>
<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="radio" value="60" disabled="true">
[BJ-BJ-B05][西城区]甘家口-三里河</td>
</tr>

<tr>
<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="radio" value="61" disabled="true">
[BJ-BJ-B06][西城区]西直门-动物园</td>
</tr>

<tr>
<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="radio" value="62" disabled="true">
[BJ-BJ-B07][西城区]后海-前海-恭王府</td>
</tr>

<tr>
<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="radio" value="63" disabled="true">
[BJ-BJ-C01][朝阳区]建国门-日坛路-永安里</td>
</tr>

<tr>
<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="radio" value="64" disabled="true">
[BJ-BJ-C02][朝阳区]朝阳门-东大桥-工体</td>
</tr>

<tr>
<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="radio" value="65" disabled="true">
[BJ-BJ-C03][朝阳区]三里屯-左家庄</td>
</tr>

<tr>
<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="radio" value="66" disabled="true">
[BJ-BJ-C04][朝阳区]三元桥-三源里-新源里</td>
</tr>

<tr>
<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="radio" value="67" disabled="true">
[BJ-BJ-C05][朝阳区]燕莎桥-亮马桥-农展桥</td>
</tr>

<tr>
<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="radio" value="68" disabled="true">
[BJ-BJ-C06][朝阳区]国贸桥</td>
</tr>

<tr>
<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="radio" value="69" disabled="true">
[BJ-BJ-C07][朝阳区]和平里-和平街北口-樱花东街</td>
</tr>

<tr>
<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="radio" value="70" disabled="true">
[BJ-BJ-C08][朝阳区]亚运村-奥体</td>
</tr>

<tr>
<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="radio" value="71" disabled="true">
[BJ-BJ-C09][朝阳区]工大桥</td>
</tr>

<tr>
<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="radio" value="72" disabled="true">
[BJ-BJ-C10][朝阳区]望京</td>
</tr>

<tr>
<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="radio" value="73" disabled="true">
[BJ-BJ-D01][海淀区]五道口</td>
</tr>

<tr>
<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="radio" value="74" disabled="true">
[BJ-BJ-D02][海淀区]人大-双榆树</td>
</tr>

<tr>
<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="radio" value="75" disabled="true">
[BJ-BJ-D03][海淀区]中关村</td>
</tr>

<tr>
<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="radio" value="76" disabled="true">
[BJ-BJ-D04][海淀区]远大路</td>
</tr>

<tr>
<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="radio" value="77" disabled="true">
[BJ-BJ-D05][海淀区]公主坟-复兴路</td>
</tr>

<tr>
<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="radio" value="78" disabled="true">
[BJ-BJ-E01][宣武区]前门</td>
</tr>

<tr>
<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="radio" value="79" disabled="true">
[BJ-BJ-E02][宣武区]菜市口</td>
</tr>

<tr>
<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="radio" value="80" disabled="true">
[BJ-BJ-E03][宣武区]宣武门</td>
</tr>

<tr>
<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="radio" value="81" disabled="true">
[BJ-BJ-F01][崇文区]崇文门-磁器口</td>
</tr>

<tr>
<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="radio" value="82" disabled="true">
[BJ-BJ-F02][崇文区]天桥-永定门</td>
</tr>

<tr>
<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="radio" value="83" disabled="true">
[BJ-BJ-G01][丰台区]方庄</td>
</tr>

<tr>
<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="radio" value="84" disabled="true">
[BJ-BJ-G02][丰台区]木樨园-大红门</td>
</tr>

</table>
<!-- 区级内容列表End -->
</td>
</tr>

</table>
<!-- 市级内容列表End -->
</td>
</tr>
<?php

}
?>
</table></td>
<td colspan="2" valign="top"><table width="100%" border="1" align="center" cellpadding="4" cellspacing="0" class="tableMain"><tr>
<td align="right">名称:</td>
<td><input name="name" type="text" maxlength="50"></td>
</tr>
<tr>
<td align="right">代码:</td>
<td><input name="code" type="text" maxlength="50"></td>
</tr>
<tr>
<td align="right">类型:</td>
<td>
<input type="radio" name="type" value="省/直辖市" onClick="showTreeByDifferent(this.value)" checked="true">省/直辖市&nbsp;
<input type="radio" name="type" value="市级" onClick="showTreeByDifferent(this.value)">市级&nbsp;
<input type="radio" name="type" value="区级" onClick="showTreeByDifferent(this.value)">区级&nbsp;</td>
</tr>
<tr>
<td align="right">&nbsp;</td>
<td><input type="submit" name="Submit" value=" 提 交 " onClick="return beforeAreaSubmit();alert(sid.value);">
<input type="reset" name="Submit2" value=" 重 置 "></td>
</tr>
</table>
</td>
</tr>

<tr>
<td class="tableBottom" colspan="3"></td>
</tr>
</table>
</form>
</body>
</html>
<script>
var ca = new Array();
ca[ca.length++] = new Array("areaForm.name.value==''", "请填写城市名称!");
ca[ca.length++] = new Array("areaForm.code.value==''", "请填写城市编号!");
ca[ca.length++] = new Array("!areaForm.type[0].checked&&areaForm.sid.value==0", "请选择上级区域!");
function beforeAreaSubmit(){
for(var i=0; i<ca.length; i++){
if(eval(ca[i][0])){
alert(ca[i][1]);
return false;
}
}
}
</script>
包错是变斜的那行说是这个错误
Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in c:\apache\htdocs\ld\area_add.php on line 101

搜索更多相关主题的帖子: connect mssql mysql php 
2007-04-25 12:56
lmhllr
Rank: 8Rank: 8
等 级:贵宾
威 望:44
帖 子:1504
专家分:42
注 册:2005-5-12
收藏
得分:0 
你上面用的mssql下面用的mysql当然错了,乱七八糟的!
2007-04-25 16:14
快速回复:[求助]看看错在哪了?
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.028340 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved