php新闻编辑怎么弄?高手帮我看看那里写错了?谢谢
程序员文章站
2022-05-17 16:37:25
...
$conn = mysql_connect("localhost","root","123");/*数据库*/
mysql_query("set names GB2312");
$db = mysql_select_db("miaolaor");
$sql="SELECT * FROM news_listing where news_Id='$_GET[AId]'";
$query=mysql_query($sql);
if($_POST['Submit'])
$sql="update news_listing set news_headline='$_POST[news_headline]',news_intro='$_POST[news_intro]',content='$_POST[content]' where news_Id='$_POST[AId]'";
//$sql = 'UPDATE `news_listing` SET `news_headline` = \'$news_headline\', `news_intro` = \'$news_intro\', `content` = \'$content\' WHERE `news_listing`.`news_Id` = \'$news_Id\' ;';
mysql_query($sql);//执行sql语句
if($sql){
echo "修改成功";
echo "返回";
}else{
echo "修改失败";
echo "返回";
}
//echo $sql;
?>
mysql_query("set names GB2312");
$db = mysql_select_db("miaolaor");
$sql="SELECT * FROM news_listing where news_Id='$_GET[AId]'";
$query=mysql_query($sql);
if($_POST['Submit'])
$sql="update news_listing set news_headline='$_POST[news_headline]',news_intro='$_POST[news_intro]',content='$_POST[content]' where news_Id='$_POST[AId]'";
//$sql = 'UPDATE `news_listing` SET `news_headline` = \'$news_headline\', `news_intro` = \'$news_intro\', `content` = \'$content\' WHERE `news_listing`.`news_Id` = \'$news_Id\' ;';
mysql_query($sql);//执行sql语句
if($sql){
echo "修改成功";
echo "返回";
}else{
echo "修改失败";
echo "返回";
}
//echo $sql;
?>
回复讨论(解决方案)
mysql_query($sql) or die(mysql_error());//执行sql语句
把SQL 语句放到数据库执行就知道了
改成
if(isset($_POST["submit"])
试试
提示什么错误了吗?把报错信息贴出来
已经弄好了 谢谢!