![]() |
Transactions and AffectedRows - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28) +--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30) +--- Thread: Transactions and AffectedRows (/showthread.php?tid=76119) |
Transactions and AffectedRows - stlake2011 - 04-15-2020 Morning all, Quick question for yall. When I am running a DB transaction, if it all goes smoothly (as reported by the transaction) I want to do a secondary check (yes I am paranoid on this front), of my own with affectedRows() but its always returning 0 whether the result of the query(ies) themselves were successful or not. Is this by design and I should just rely on what the transaction reports and bypass the affectedRows() function altogether? Extremely oversimplified example: PHP Code: $sql1 = "INSERT INTO tbl1(id,field1) VALUES(?,?); The false result array in the affectedRows seems to always return on success or not. Should I try a manual transaction or would that return the same as the automatic transaction above? |