Are you familiar with transactions or PDO? Always roll back and the data database type cannot be deleted: sqlite & nbsp; no error is Prompted. one row is tested and there is no error. why always roll back? I always roll back. I cannot delete the data. & nbsp; what are the reasons? The following is the descriptive code: PHPcode $ king-& gt; db-& gt; connect (); connect to the database $ link as the database connection handle. $ King-& Are you familiar with transactions or PDO? Always roll back, data cannot be deleted
Database type: sqlite
No error is Prompted. there is indeed no error in one row of tests. why is it always rolled back? Always roll back, data cannot be deleted
What are the possible reasons?
The following is the descriptive code:
PHP code
$ King-> db-> connect (); // connect to the database $ link is the database connection handle. $ King-> db-> link-> beginTransaction (); // if ($ rs1 = $ king-> db-> getRows_number ('% s_newsContent ', "newsID in ($ newsID)") {if ($ rs2 = $ king-> db-> query ("delete from % s_newsContent where newsID in ($ newsID )")) {$ s. = "news content deleted! [". $ Rs2."/". $ rs1."]
";} Else {lzj_message ('failed to delete news content', 'javascript: history. go (-1) ') ;}} if ($ rs1 = $ king-> db-> getRows_number (' % s_rss ', "idValue in ($ newsID) and tableName = 'new' and idName = 'newsid '")) {if ($ rs2 = $ king-> db-> query ("delete from % s_rss where tableName = 'news' and idName = 'newsid 'and idValue in ($ newsID) ") {$ s. = "News RSS has been deleted! [". $ Rs2."/". $ rs1."]
";} Else {lzj_message ('failed to delete the News RSS ', 'javascript: history. go (-1) ') ;}}if ($ rs = $ king-> db-> query ("delete from % s_news where newsID in (". $ newsID. ")") {lzj_message ("deleted successfully! [". $ Rs."]
". $ S, $ pageUrl);} else {lzj_message ('news deletion failed', 'javascript: history. go (-1) ');} $ king-> db-> link-> commit (); // roll back the end point
------ Solution --------------------
I feel you have a problem writing this method.
You can set up an identifier such as flag = true at the beginning of a transaction;
If ($ flag ){
Your operations ........
} Else {
..............
$ Flag = false;
}
Continue the next operation as above
Last
If ($ flag ){
Submit things
} Else {
Rollback
}