wpdb question moving data then deleting
-
So I have this in a function and I cannot see why it isnt working, any clues please? It doesnt write to the archive table or delete from the original table
if (isset($_POST['cleanold'])) { $cleanup = $wpdb->get_results("select * from wp_applications where Available_To < $date", ARRAY_A); $table_name = $wpdb->prefix . "wp_applications_archive"; foreach ($cleanup as $roww){ $roww_id = $roww->id; $archive_success = $wpdb->query("INSERT INTO wp_applications_archive SELECT * FROM wp_applications where id= $roww_id"); } if($archive_success){ echo("Done"); }else{ echo("Nothing happened"); } $result = $wpdp->get_results("SELECT * FROM wp_applications where Available_To < $date", ARRAY_A); foreach($result as $row){ $row_id = $row->id; $wpdb->delete(wp_applications, array('id'=>$row_id)); } }
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘wpdb question moving data then deleting’ is closed to new replies.