更新命令输出

时间:2014-07-23 16:04:49

标签: php mysql

我想在记录不存在时写一个更新命令。发消息后

    mysqli_query($connection,"UPDATE system SET count  ='1'   where  code ='929'");

我的意思是,如果有一个929代码的记录字段更新信息,否则给出消息

1 个答案:

答案 0 :(得分:1)

试试这个:

$num_modified = mysqli_query($connection,"UPDATE system SET count  ='1'   where  code ='929'");
if ($num_modified != 1) { 
 echo "Failed to modify!";
}