Home > Backend Development > PHP Tutorial > php新闻编辑怎么弄?高手帮我看看那里写错了?谢谢

php新闻编辑怎么弄?高手帮我看看那里写错了?谢谢

WBOY
Release: 2016-06-23 13:14:41
Original
995 people have browsed it


    $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($sql)  or die(mysql_error());//执行sql语句

把SQL 语句放到数据库执行就知道了

改成
if(isset($_POST["submit"])  
试试

提示什么错误了吗?把报错信息贴出来

已经弄好了  谢谢!

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