mysql数据更新 $result=mysql_query("$query",$con) or die(mysql_error());看看出错提示。 :) 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 请问hahawen(变态的大龄青年) ,你说的是什么意思?因为我是根据where条件来只更新部分数据的。 where 后面的变量加上单引号试试吧。 这是从数据库中获得数据的页面,在文本框中输入修改的值,然后点修改按钮调用forderupdate2.php,来完成更新功能,可是运行没有错误,就是更新不了值,请哪位指点一下了。解决问题立即给分<html><head> <title>修改订单</title></head><body> <script src="..\menu.js" language="javascript"></script><?php include "sescheck.php"; include "conn.php"; $query="select * from forecast where fcno = $flag"; $result=mysql_query("$query",$con); $r=mysql_fetch_array($result); //赋值 $fcno=$r["fcno"] ; $fcpartno=$r["fcpartno"]; $fcdate=$r["fcdate"]; $fcpartno2=$r["fcpartno2"]; $fcmoldno=$r["fcmoldno"]; $fcexplan=$r["fcexplan"]; $fcnumber=$r["fcnumber"]; $fcdate2=$r["fcdate2"]; $fcexplan2=$r["fcexplan2"]; //$fcaddid=$r["fcaddid"]; //$fcadddt=$r["fcadddt"]; //$fcmodid=$r["fcmodid"]; //$fcmoddt=$r["fcmoddt"]; ?><P align="center"><font size="5" color="00000c"></font></P><p></p><div align="center"><center><p><b>修改订单内容</b></p><table align="center" width="80%" border="1" cellspacing="0" cellpadding="4" bordercolorlight="#CC9966" bgcolor="#00F2EE" bordercolordark="#FFFFFF" class="LZH"><tr bgcolor="#F7F2ff" style="font-size:14.8px;font-weight:bold"><tr><td width="183" align="right" height="23"><p align="right">订单编号:</td><center><td width="476" height="23"><input type="text" name="fcnotxt" value=<?php echo $flag ?> ></td></tr></center><tr><td width="183" align="right" height="23"><p align="right">料号1:</td><center><td width="476" height="23"><input type="text" name="fcpartnotxt" value=<?php echo $fcpartno ?> ></td></tr><tr><td width="183" align="right" height="23"><p align="right">日期:</td><center><td width="476" height="23"><input type="text" name="fcdatetxt" value=<?php echo $fcdate ?> ></td></tr><tr><td width="183" align="right" height="23"><p align="right">料号2:</td><center><td width="476" height="23"><input type="text" name="fcpartno2txt" value=<?php echo $fcpartno2 ?> ></td></tr><tr><td width="183" align="right" height="23"><p align="right">模号:</td><center><td width="476" height="23"><input type="text" name="fcmoldnotxt" value=<?php echo $fcmoldno ?> ></td></tr><tr><td width="183" align="right" height="23"><p align="right">料号2说明:</td><center><td width="476" height="23"><input type="text" name="fcexpalntxt" value=<?php echo $fcexplan ?> ></td></tr><tr><td width="183" align="right" height="23"><p align="right">数量:</td><center><td width="476" height="23"><input type="text" name="fcnumbertxt" value=<?php echo $fcnumber ?> ></td></tr><tr><td width="183" align="right" height="23"><p align="right">需求日期:</td><center><td width="476" height="23"><input type="text" name="fcdate2txt" value=<?php echo $fcdate2 ?> ></td></tr><tr><td width="183" align="right" height="23"><p align="right">料号1说明:</td><center><td width="476" height="23"><input type="text" name="fcexplan2txt" value=<?php echo $fcexplan2 ?> ></td></tr><tr><td width="183" align="right" height="23"><p align="right">新增者:</td><center><td width="476" height="23"><input type="text" name="fcaddidtxt" value="" ></td></tr><tr><td width="183" align="right" height="23"><p align="right">新增时间:</td><center><td width="476" height="23"><input type="text" name="fcadddttxt" value="" ></td></tr><tr><td width="183" align="right" height="23"><p align="right">修改者:</td><center><td width="476" height="23"><input type="text" name="fcmodtxt" value=<?php echo $user ?> ></td></tr><tr><td width="183" align="right" height="23"><p align="right">修改时间:</td><center><td width="476" height="23"><input type="text" name="fcmoddttxt" value=<?php print(date( "Y-m-j" )) ?> ></td></tr> </tr></table> <center><table width="778" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="371" align="right"> <form name="form1" method="post" action="forderupdate2.php"> <input type="submit" name="Submit" value="修改"> </form></td> <td width="407"><form name="form2" method="post" action="fordermodify.php"> <input type="submit" name="Submit" value="返回"> </form></td> </tr></table> </center><p> </p></body></html>forderupdat2.php的代码如下:<html> <title>更新订单</title><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312"><link href="font1.css" rel="stylesheet" type="text/css"></head><body bgcolor="f4f4f4" leftmargin="0" topmargin="0"><?phpinclude "sescheck.php";//检查用户合法性include "conn.php";//数据库连接$query="update forecast set fcdate='$fcdatetxt',fcpartno2='$fcpartno2txt',fcmoldno='$fcmoldnotxt',fcexplan='$fcexplantxt',fcnumber='$fcnumbertxt',fcdate2='$fcdate2txt',fcexplan2='$fcexplan2txt',fcaddid='$fcaddidtxt',fcadddt='$fcadddttxt',fcmodid='$fcmodtxt',fcmoddt='$fomoddttxt' where fcno = '$fcnotxt' and fcpartno='$fcpartnotxt' ";$result=mysql_query("$query",$con)or die(mysql_error());require("showForecast.php");//调用显示?></p></body></html> '$fcexplan2txt'单引号改为双引号 微信消息接口使用,在提供的demo中引用自己写的类出现问题 require中使用绝对路径的问题:常量重定义,变量覆盖,重调用增加开销。 急求一正则,删除字符中的某一段字符 这两个PHP语法你见过吗??? 模板发展进程的又二疑问:模块存放问题 在PHP中,怎样比较两个日期相距有多少天啊? 看一下这个小程序为什么不出结果 那位仁兄帮我写一个用户登录验证我代码!感恩不尽! 大家是怎样debug PHP的啊? thinkphp分页和跳页 关于繁體中文輸出圖片的奇怪問題,大家幫忙看看,謝謝! 关于用php更新数据库,那位知道原理。谢谢!
因为我是根据where条件来只更新部分数据的。
forderupdate2.php,来完成更新功能,可是运行没有错误,就是更新不了值,请哪位指点一下了。解决问题立即给分
<html><head>
<title>修改订单</title>
</head><body>
<script src="..\menu.js" language="javascript"></script>
<?php
include "sescheck.php";
include "conn.php";
$query="select * from forecast where fcno = $flag";
$result=mysql_query("$query",$con);
$r=mysql_fetch_array($result);
//赋值
$fcno=$r["fcno"] ;
$fcpartno=$r["fcpartno"];
$fcdate=$r["fcdate"];
$fcpartno2=$r["fcpartno2"];
$fcmoldno=$r["fcmoldno"];
$fcexplan=$r["fcexplan"];
$fcnumber=$r["fcnumber"];
$fcdate2=$r["fcdate2"];
$fcexplan2=$r["fcexplan2"];
//$fcaddid=$r["fcaddid"];
//$fcadddt=$r["fcadddt"];
//$fcmodid=$r["fcmodid"];
//$fcmoddt=$r["fcmoddt"]; ?>
<P align="center"><font size="5" color="00000c">
</font></P>
<p></p>
<div align="center">
<center>
<p><b>修改订单内容</b></p>
<table align="center" width="80%" border="1" cellspacing="0" cellpadding="4" bordercolorlight="#CC9966" bgcolor="#00F2EE" bordercolordark="#FFFFFF" class="LZH"><tr bgcolor="#F7F2ff" style="font-size:14.8px;font-weight:bold">
<tr>
<td width="183" align="right" height="23">
<p align="right">订单编号:
</td>
<center>
<td width="476" height="23">
<input type="text" name="fcnotxt" value=<?php echo $flag ?> >
</td>
</tr>
</center>
<tr>
<td width="183" align="right" height="23">
<p align="right">料号1:
</td>
<center>
<td width="476" height="23">
<input type="text" name="fcpartnotxt" value=<?php echo $fcpartno ?> >
</td>
</tr>
<tr>
<td width="183" align="right" height="23">
<p align="right">日期:
</td>
<center>
<td width="476" height="23">
<input type="text" name="fcdatetxt" value=<?php echo $fcdate ?> >
</td>
</tr>
<tr>
<td width="183" align="right" height="23">
<p align="right">料号2:
</td>
<center>
<td width="476" height="23">
<input type="text" name="fcpartno2txt" value=<?php echo $fcpartno2 ?> >
</td>
</tr>
<tr>
<td width="183" align="right" height="23">
<p align="right">模号:
</td>
<center>
<td width="476" height="23">
<input type="text" name="fcmoldnotxt" value=<?php echo $fcmoldno ?> >
</td>
</tr>
<tr>
<td width="183" align="right" height="23">
<p align="right">料号2说明:
</td>
<center>
<td width="476" height="23">
<input type="text" name="fcexpalntxt" value=<?php echo $fcexplan ?> >
</td>
</tr>
<tr>
<td width="183" align="right" height="23">
<p align="right">数量:
</td>
<center>
<td width="476" height="23">
<input type="text" name="fcnumbertxt" value=<?php echo $fcnumber ?> >
</td>
</tr>
<tr>
<td width="183" align="right" height="23">
<p align="right">需求日期:
</td>
<center>
<td width="476" height="23">
<input type="text" name="fcdate2txt" value=<?php echo $fcdate2 ?> >
</td>
</tr>
<tr>
<td width="183" align="right" height="23">
<p align="right">料号1说明:
</td>
<center>
<td width="476" height="23">
<input type="text" name="fcexplan2txt" value=<?php echo $fcexplan2 ?> >
</td>
</tr>
<tr>
<td width="183" align="right" height="23">
<p align="right">新增者:
</td>
<center>
<td width="476" height="23">
<input type="text" name="fcaddidtxt" value="" >
</td>
</tr>
<tr>
<td width="183" align="right" height="23">
<p align="right">新增时间:
</td>
<center>
<td width="476" height="23">
<input type="text" name="fcadddttxt" value="" >
</td>
</tr>
<tr>
<td width="183" align="right" height="23">
<p align="right">修改者:
</td>
<center>
<td width="476" height="23">
<input type="text" name="fcmodtxt" value=<?php echo $user ?> >
</td>
</tr>
<tr>
<td width="183" align="right" height="23">
<p align="right">修改时间:
</td>
<center>
<td width="476" height="23">
<input type="text" name="fcmoddttxt" value=<?php print(date( "Y-m-j" )) ?> >
</td>
</tr> </tr>
</table>
<center>
<table width="778" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="371" align="right">
<form name="form1" method="post" action="forderupdate2.php">
<input type="submit" name="Submit" value="修改">
</form></td>
<td width="407"><form name="form2" method="post" action="fordermodify.php">
<input type="submit" name="Submit" value="返回">
</form></td>
</tr>
</table> </center>
<p> </p>
</body></html>forderupdat2.php的代码如下:
<html>
<title>更新订单</title>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="font1.css" rel="stylesheet" type="text/css">
</head>
<body bgcolor="f4f4f4" leftmargin="0" topmargin="0">
<?php
include "sescheck.php";//检查用户合法性
include "conn.php";//数据库连接
$query="update forecast set fcdate='$fcdatetxt',fcpartno2='$fcpartno2txt',fcmoldno='$fcmoldnotxt',fcexplan='$fcexplantxt',fcnumber='$fcnumbertxt',fcdate2='$fcdate2txt',
fcexplan2='$fcexplan2txt',fcaddid='$fcaddidtxt',fcadddt='$fcadddttxt',fcmodid='$fcmodtxt',fcmoddt='$fomoddttxt' where fcno = '$fcnotxt' and fcpartno='$fcpartnotxt' ";
$result=mysql_query("$query",$con)or die(mysql_error());
require("showForecast.php");//调用显示
?>
</p>
</body></html>