Home > php教程 > php手册 > PHP+MySQL修改记录的方法

PHP+MySQL修改记录的方法

WBOY
Release: 2016-06-06 20:13:30
Original
1488 people have browsed it

这篇文章主要介绍了PHP+MySQL修改记录的方法,实例分析了mysql修改记录的技巧,需要的朋友可以参考下

本文实例讲述了PHP+MySQL修改记录的方法。分享给大家供大家参考。具体如下:

复制代码 代码如下:


修改记录

 
    if(isset($_POST['btnModify'])){ 
        //验证表单省略 
        $sql = "UPDATE animal SET WHERE ID = '$_POST[id]'"; 
        $result = mysqli_query($sql);   //执行更新 
        if($result){ 
            echo "修改已经成功!"; 
        } 
        else 
        { 
            echo "修改失败!"; 
        } 
    } 
    //查询当前的记录 
    $query = "SELECT * FROM symbols"; 
    //执行该查询 
    if($result = $mysqli->query($query)){ 
        //显示返回的记录集行数 
        if($result->num_rows>0){ 
            //如果有记录 
            //显示记录集中列的内容 
            echo ""; 
            while($row=$result->fetch_array()){ 
                echo ""; 
                echo ""; 
                echo ""; 
                echo ""; 
                echo ""; 
                echo ""; 
            } 
        } 
        //释放对象所占用的内存 
        $result->close(); 
    } 
?>

希望本文所述对大家的php+mysql程序设计有所帮助。

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 Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template