php 根据上一页传过来的ID读取相应ID的数据库在表单上显示,并且点击修改可以修改数据库的内容。 15
现在的问题是在表单上不能显示数据库的内容,提示56行出错,请高手赐教。<?phpdefine('IN_ECS',true);require(dirname(__FILE_...
现在的问题是在表单上不能显示数据库的内容,提示56行出错,请高手赐教。
<?php
define('IN_ECS', true);
require(dirname(__FILE__) . '/includes/init.php');
$ab=$_GET[idu];
?>
<?php
$conn = mysql_connect("localhost","51ra","b4g6w2");
$sql = mysql_select_db("51ra",$conn) or die ("连接错误!");
$action = $_POST['action'];
if($action == 'send')
{
$lj_id = $_POST['lj_id'];
$lj_name = $_POST['lj_name'];
$lj_xianghao = $_POST['lj_xianghao'];
$lj_guige = $_POST['lj_guige'];
$lj_pinji = $_POST['lj_pinji'];
$lj_number = $_POST['lj_number'];
$sql = "UPDATE ecs_goods_yudinglj
SET
lj_name='$lj_name',
lj_xianghao='$lj_xianghao',
lj_guige='$lj_guige',
lj_pinji='$lj_pinji',
lj_number='$lj_number'
WHERE
lj_id = '$lj_id' ";
//$result = mysql_query($sql,$conn);
mysql_query($sql,$conn);
echo $sql;
//exit;
}
//echo $sql;
//echo $result;
?>
<div align="center">商品属性修改</div>
<form method="post" name="shangpinxiugai" action="#">
<input type="hidden" name="action" value="send">
<?php
$sql="select * from ecs_goods_yudinglj where id= ".$ab." ";
$query = mysql_query($sql,$conn);
$row = mysql_fetch_array($query);
?>
<div align="center"> <dl>
<dd>ID:<?php echo $row[lj_id];?></dd>
<dd>名称:<input type="text" name="lj_name" value="<?php echo $row[lj_name];?>"/></dd>
<dd>型号:<input type="text" name="lj_xianghao" value="<?php echo $row[lj_xianghao];?>"/></dd>
<dd>规格:<input type="text" name="lj_guige" value="<?php echo $row[lj_guige];?>"/></dd>
<dd>品级:<input type="text" name="lj_pinji" value="<?php echo $row[lj_pinji];?>"/></dd>
<dd>数量:<input type="text" name="lj_number" value="<?php echo $row[lj_number];?>"/></dd>
</dl>
<td><input name='bthModify' type='submit' id='bthModify' value='修改' /></td><br>
<td><input type="button" name="Submit2" value="返回" onclick="history.go(-1)" /></td>
</div>
</form> 展开
<?php
define('IN_ECS', true);
require(dirname(__FILE__) . '/includes/init.php');
$ab=$_GET[idu];
?>
<?php
$conn = mysql_connect("localhost","51ra","b4g6w2");
$sql = mysql_select_db("51ra",$conn) or die ("连接错误!");
$action = $_POST['action'];
if($action == 'send')
{
$lj_id = $_POST['lj_id'];
$lj_name = $_POST['lj_name'];
$lj_xianghao = $_POST['lj_xianghao'];
$lj_guige = $_POST['lj_guige'];
$lj_pinji = $_POST['lj_pinji'];
$lj_number = $_POST['lj_number'];
$sql = "UPDATE ecs_goods_yudinglj
SET
lj_name='$lj_name',
lj_xianghao='$lj_xianghao',
lj_guige='$lj_guige',
lj_pinji='$lj_pinji',
lj_number='$lj_number'
WHERE
lj_id = '$lj_id' ";
//$result = mysql_query($sql,$conn);
mysql_query($sql,$conn);
echo $sql;
//exit;
}
//echo $sql;
//echo $result;
?>
<div align="center">商品属性修改</div>
<form method="post" name="shangpinxiugai" action="#">
<input type="hidden" name="action" value="send">
<?php
$sql="select * from ecs_goods_yudinglj where id= ".$ab." ";
$query = mysql_query($sql,$conn);
$row = mysql_fetch_array($query);
?>
<div align="center"> <dl>
<dd>ID:<?php echo $row[lj_id];?></dd>
<dd>名称:<input type="text" name="lj_name" value="<?php echo $row[lj_name];?>"/></dd>
<dd>型号:<input type="text" name="lj_xianghao" value="<?php echo $row[lj_xianghao];?>"/></dd>
<dd>规格:<input type="text" name="lj_guige" value="<?php echo $row[lj_guige];?>"/></dd>
<dd>品级:<input type="text" name="lj_pinji" value="<?php echo $row[lj_pinji];?>"/></dd>
<dd>数量:<input type="text" name="lj_number" value="<?php echo $row[lj_number];?>"/></dd>
</dl>
<td><input name='bthModify' type='submit' id='bthModify' value='修改' /></td><br>
<td><input type="button" name="Submit2" value="返回" onclick="history.go(-1)" /></td>
</div>
</form> 展开
4个回答
展开全部
$sql="select * from ecs_goods_yudinglj where id= ".$ab." ";
改成$sql="select * from ecs_goods_yudinglj where id= '$ab'";
改成$sql="select * from ecs_goods_yudinglj where id= '$ab'";
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
$sql="select * from ecs_goods_yudinglj where id= ".$ab." ";
改成$sql="select * from ecs_goods_yudinglj where id= ".$ab;
改成$sql="select * from ecs_goods_yudinglj where id= ".$ab;
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
看不清楚,把错误贴出来,把错误行代码贴出来
追问
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/51ram5418rpa/wwwroot/kxqccadm/_goods_dingzhixiugai.php on line 56
追答
没有查找到值,mysql_fetch_array如果转换失败就会有这个,你的查询是失败的或者查询没有结果
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询