本文实例讲述了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 "
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