php 填写对应的id修改对应的数据库,但点击修改,数据库没变化,请高人提点!
<?$conn=mysql_connect("localhost","111","222");$action=$_POST['action'];if($action=='...
<?
$conn = mysql_connect("localhost","111","222");
$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'];
mysql_select_db("51ra",$conn);
$sql="update news
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);
}
?>
<div align="center">商品属性修改</div>
<div align="center">
<form method="post" name="shangpinxiugai" action="_goods_dingzhixiugai.php">
<input type="hidden" name="action" value="send">
<dl>
<dd>ID:<input type="text" name="lj_id" /></dd>
<dd>名称:<input type="text" name="lj_name" /></dd>
<dd>型号:<input type="text" name="lj_xianghao" /></dd>
<dd>规格:<input type="text" name="lj_guige" /></dd>
<dd>品级:<input type="text" name="lj_pinji" /></dd>
<dd>数量:<input type="text" name="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>
</form>
</div> 展开
$conn = mysql_connect("localhost","111","222");
$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'];
mysql_select_db("51ra",$conn);
$sql="update news
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);
}
?>
<div align="center">商品属性修改</div>
<div align="center">
<form method="post" name="shangpinxiugai" action="_goods_dingzhixiugai.php">
<input type="hidden" name="action" value="send">
<dl>
<dd>ID:<input type="text" name="lj_id" /></dd>
<dd>名称:<input type="text" name="lj_name" /></dd>
<dd>型号:<input type="text" name="lj_xianghao" /></dd>
<dd>规格:<input type="text" name="lj_guige" /></dd>
<dd>品级:<input type="text" name="lj_pinji" /></dd>
<dd>数量:<input type="text" name="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>
</form>
</div> 展开
2个回答
展开全部
你运行一下下面代码看看、、、输出什么
<?
$conn = mysql_connect("localhost","111","222");
$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'];
mysql_select_db("51ra",$conn);
$sql="update news
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' ";
echo $sql;
exit;
$result = mysql_query($sql,$conn);
}
?>
<div align="center">商品属性修改</div>
<div align="center">
<form method="post" name="shangpinxiugai" action="_goods_dingzhixiugai.php">
<input type="hidden" name="action" value="send">
<dl>
<dd>ID:<input type="text" name="lj_id" /></dd>
<dd>名称:<input type="text" name="lj_name" /></dd>
<dd>型号:<input type="text" name="lj_xianghao" /></dd>
<dd>规格:<input type="text" name="lj_guige" /></dd>
<dd>品级:<input type="text" name="lj_pinji" /></dd>
<dd>数量:<input type="text" name="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>
</form>
</div>
<?
$conn = mysql_connect("localhost","111","222");
$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'];
mysql_select_db("51ra",$conn);
$sql="update news
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' ";
echo $sql;
exit;
$result = mysql_query($sql,$conn);
}
?>
<div align="center">商品属性修改</div>
<div align="center">
<form method="post" name="shangpinxiugai" action="_goods_dingzhixiugai.php">
<input type="hidden" name="action" value="send">
<dl>
<dd>ID:<input type="text" name="lj_id" /></dd>
<dd>名称:<input type="text" name="lj_name" /></dd>
<dd>型号:<input type="text" name="lj_xianghao" /></dd>
<dd>规格:<input type="text" name="lj_guige" /></dd>
<dd>品级:<input type="text" name="lj_pinji" /></dd>
<dd>数量:<input type="text" name="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>
</form>
</div>
追问
只加echo $sql;不加exit;如果加exit;的话就没显示,加echo $sql;以后,填写表单出现:update ecs_goods_yudinglj set lj_name='', lj_xianghao='师傅给师傅', lj_guige='', lj_pinji='', lj_number='' where lj_id = '36'
但还是update不了数据库。
追答
商品属性修改
ID:
名称:
型号:
规格:
品级:
数量:
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
<?
$conn = mysql_connect("localhost","111","222");
$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'];
mysql_select_db("51ra",$conn);
$sql="update news
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);
}
?>
<div align="center">商品属性修改</div>
<div align="center">
<form method="post" name="shangpinxiugai" action="_goods_dingzhixiugai.php">
<input type="hidden" name="action" value="send">
<dl>
<dd>ID:<input type="text" name="lj_id" /></dd>
<dd>名称:<input type="text" name="lj_name" /></dd>
<dd>型号:<input type="text" name="lj_xianghao" /></dd>
<dd>规格:<input type="text" name="lj_guige" /></dd>
<dd>品级:<input type="text" name="lj_pinji" /></dd>
<dd>数量:<input type="text" name="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>
</form>
</div>
您试试代码看行不行。
$conn = mysql_connect("localhost","111","222");
$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'];
mysql_select_db("51ra",$conn);
$sql="update news
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);
}
?>
<div align="center">商品属性修改</div>
<div align="center">
<form method="post" name="shangpinxiugai" action="_goods_dingzhixiugai.php">
<input type="hidden" name="action" value="send">
<dl>
<dd>ID:<input type="text" name="lj_id" /></dd>
<dd>名称:<input type="text" name="lj_name" /></dd>
<dd>型号:<input type="text" name="lj_xianghao" /></dd>
<dd>规格:<input type="text" name="lj_guige" /></dd>
<dd>品级:<input type="text" name="lj_pinji" /></dd>
<dd>数量:<input type="text" name="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>
</form>
</div>
您试试代码看行不行。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询