php - 如何检查更新是否完成

标签 php mysql codeigniter

我正在更新一个表,如何检查更新是否成功。我将结果存储在$Result中当我打印它时,它会给出以下输出。

CI_DB_mysqli_result Object
(
    [conn_id] => mysqli Object (
            [affected_rows] => 0
            [client_info] => mysqlnd 5.0.8-dev - 20102224 - $Revision: 310735 $
            [client_version] => 50008
            [connect_errno] => 0
            [connect_error] => 
            [errno] => 0
            [error] => 
            [field_count] => 0
            [host_info] => localhost via TCP/IP
            [info] => 
            [insert_id] => 0
            [server_info] => 5.5.16
            [server_version] => 50516
            [sqlstate] => 00000
            [protocol_version] => 10
            [thread_id] => 765
            [warning_count] => 0
    )
    [result_id] => 1
    [result_array] => Array ()
    [result_object] => Array ()
    [custom_result_object] => Array ()
    [current_row] => 0
    [num_rows] => 
    [row_data] => 
)

最佳答案

you can check your affected rows in php like 
if($this->db->affected_rows() > 0){ //affected rows}

or in codeigniter 

if($this->db->affected_rows() > 0)
{
    return TRUE;
}else{
    return FALSE;
}

关于php - 如何检查更新是否完成,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9582671/

相关文章:

php - 无法从我的 codeigniter 查询代码中获得正确的输出

php - 在 PHP 中按文件名对文件进行排序 - 2011 年 3 月、2011 年 4 月、2011 年 5 月等

php - 更新具有最大值的行

php - 富文本和参数化查询,我应该担心吗?

php - 使用 codeigniter 上传时为 "did not select a file to upload"

php - 无法加载 URL : The domain of this URL isn't included in the app's domains. 要能够加载此 URL... Codeigniter

PHP 选择查询

php - 标题标签未按预期显示

mysql - 如果我想搜索以 DE-SB 和 DE-TB 开头的 SKU,如何在 SQL 中使用 LIKE 通配符? [] 在这里如何工作?

php - 如何编辑此 mySQL 以便将相同 id 的行合并为 1 而不是 3?