Are you familiar with the business or PDO? Always rollback, delete data
Database type: SQLite
No prompt error, one line test, there is no error, why always rollback? Always rollback, delete data
What do you suppose is the reason?
Here is the explanatory code:
PHP Code
$king->db->connect (); Connect the database $link a handle to the database connection. $king->db->link->begintransaction ();//Roll back the starting point if ($rs 1= $king->db->getrows_number ('%s_newscontent ', " NewsID in ($newsID))} {if ($rs 2= $king->db->query ("Delete from%s_newscontent where NewsID in ($newsID)")) {$ s.= "Delete news content successfully! [". $rs 2." /". $rs 1." Reviews
"; } else {lzj_message (' Delete news content failed ', ' Javascript:history.go (-1) '); }} if ($rs 1= $king->db->getrows_number ('%s_rss ', "idvalue in ($newsID) and tablename= ' News ' and Idname= ' NewsID '")) {if ($rs 2= $king->db->query ("Delete from%s_rss where tablename= ' news ' and Idname= ' NewsID ' and idvalue in ($newsI D)) {$s. = "Delete News RSS success!" [". $rs 2." /". $rs 1." Reviews
"; } else {lzj_message (' Delete news rss failed ', ' Javascript:history.go (-1) '); }} if ($rs = $king->db->query ("Delete from%s_news where NewsID in (". $newsID. ")") {lzj_message ("Delete succeeded! [". $rs." Reviews
". $s, $PAGEURL); } else {lzj_message (' Delete news failed ', ' Javascript:history.go (-1) '); } $king->db->link->commit ();//rollback end point
------Solution--------------------
I feel like you have a problem with this writing.
You can start things by setting up a logo such as flag=true;
if ($flag) {
Your operation .....
} else{
..............
$flag = false;
}
Continue with the next operation as above
At last
if ($flag) {
Submit Things
}else{
Rolling back
}