Home >Backend Development >PHP Tutorial >PHP+MySQL修改记录的方法_PHP

PHP+MySQL修改记录的方法_PHP

WBOY
WBOYOriginal
2016-05-31 13:17:15904browse

本文实例讲述了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程序设计有所帮助。

Statement:
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