简体   繁体   English

返回受更新查询影响的行数?

[英]Return number of rows affected by update query?

I have a php query: 我有一个PHP查询:
$result = pg_query("UPDATE schema.table SET column = 'value' WHERE column_two = 'value_two');

I should be able to return an integer value for the number of affected rows using: 我应该能够使用以下方法为受影响的行数返回一个整数值:
$int_value = pg_num_rows($result)

I then make a comparison with $int_value however neither a result resource or an integer is being assigned to $int_value 然后,我与$int_value进行比较,但是没有将结果资源或整数分配给$int_value

When i echo the variables, nothing is returned (I would expect a result Id from the initial query and an integer from $int_value ) 当我回显变量时,什么也不会返回(我期望初始查询的结果ID和$int_value的整数)

I have echoed & run the query string alone successfully. 我已经回显并成功单独运行了查询字符串。

How can I assign the integer number of affected rows from the query to a variable? 如何将查询中受影响的行的整数分配给变量?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM