日期:2014-05-17  浏览次数:20441 次

php修改表单中的内容不成功
<?php
  require_once("dbConnect.inc");
require_once("myOperation.inc");
$conn = sql_connect();
mysql_select_db("gateway_data");

$conn = sql_connect();
  mysql_select_db("gateway_data");
$exec="select * from contents1 where id=".$_GET['id'];
  $exec1="update contents1 set name='".$_POST['name']."',
daily_date='".$_POST['daily_date']."',
project_name='".$_POST['project_name']."',
content='".$_POST['content']."',
opinion='".$_POST['opinion']."' where id=".$_GET['id'];
  $result=mysql_query($exec1);
   
  if( $result>0)
echo "修改日报成功!" ;
else 
echo "修改日报失败……";
 echo "<p><a href=report_test.php ><center>返回主页面</center></a>";
 mysql_close();
?>
<html><head><meta http-equiv='Refresh' content='2; URL=report_test.php'>
<link href="sinoStyle/stylew.css" rel="stylesheet" type="text/css"></head>
<body><p align="center"></p></body></html>
这个是一个修改页面的逻辑页面,为什么不能修改成功呢?坐等高手回答结贴

------解决方案--------------------
echo $exec1; //贴出来看看
------解决方案--------------------
1. $exec="select * from contents1 where id=".$_GET['id']; //此句在上下文中没有任何价值

2. 输出 $exec1 查看该SQL语句能收执行,此句中又是GET,又是POST的,怀疑$_GET['id']此变量未接收到值~

3. 建议使用try…catch(){}来捕捉异常信息~