Use wpdb -> update to update mutiple row
-
I’m trying to update multiple rows once, I use the array to store the data and I use for loop to try to update the data but it’s not working because the data in the database is still the same. What am I doing wrongly? Or is there any better way to do this?
global $wpdb; $table_name = $wpdb -> prefix . 'test'; $check_first = 1; $check_second = 2; $update = array ( array ( 'value' => $check_first ), array ( 'value' => $check_second ) ); $condition = array ( array ( 'name' => 'enable' ), array ( 'name' => 'picked' ) ); for ( $x = 0; $x <= 2; $x++ ) { $wpdb -> update ( $table_name, $update, $condition ); }
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Use wpdb -> update to update mutiple row’ is closed to new replies.