Public & nbsp; static & nbsp; function & nbsp; delete ($ table, & nbsp; $ condition, & nbsp; $ limit & nbsp; = & nbsp; 0, & nbsp; $ un discuz x2.5 about the discuz_database class
Public static function delete ($ table, $ condition, $ limit = 0, $ unbuffered = true ){
If (empty ($ condition )){
Return false;
} Elseif (is_array ($ condition )){
If (count ($ condition) = 2 & isset ($ condition ['where']) & isset ($ condition ['Arg ']) {
$ Where = self: format ($ condition ['where'], $ condition ['Arg ']);
} Else {
$ Where = self: implode_field_value ($ condition, 'and ');
}
} Else {
$ Where = $ condition;
}
$ Limit = dintval ($ limit );
$ SQL = "DELETE FROM". self: table ($ table). "WHERE $ where". ($ limit? "LIMIT $ limit ":'');
Return self: query ($ SQL, ($ unbuffered? 'Unbuffered ':''));
}
$ Where = self: format ($ condition ['where'], $ condition ['Arg ']); 21. $ condition ['Arg '] what does it mean?
Share:
------ Solution --------------------
A key value in the array
------ Solution --------------------
It should be such a delete method that requires the condition. In this method, the most condition format is merged into the final SQL statement. as for $ condition ['Arg '], you can print it directly. .....