Home > Backend Development > PHP Tutorial > php批改表单中的内容不成功

php批改表单中的内容不成功

WBOY
Release: 2016-06-13 10:44:24
Original
637 people have browsed it

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 "

返回主页面
";
 mysql_close();
?>




这个是一个修改页面的逻辑页面,为什么不能修改成功呢?坐等高手回答结贴

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

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

3. 建议使用try…catch(){}来捕捉异常信息~
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template