如何使用php存储变量中受影响的行数?

时间:2017-05-30 05:27:14

标签: php

以下是我的代码的样子

$update = mysql_query("update profile set status=1 where id='$id_ex'")or die("error from $update".mysql_error());

printf("Affected record is : %d\n", mysql_affected_rows());

谢谢

1 个答案:

答案 0 :(得分:0)

直接存储在可变的

$update = mysql_query("update profile set status=1 where id='$id_ex'")or die("error from $update".mysql_error());
$affected_rows = mysql_affected_rows();
printf("Affected record is $affected_rows");

下面是php documentaion mysql_affected_rows()