我有一個帶有自定義表的wordpress數據庫wp_new_term_relationships
我需要一個函數將該表中的所有記錄附加到表wp_term_relationships
然後它會刪除所有數據在第一個表,是這樣的:我需要一個函數將數據從一個表追加到另一個表中
function jr_cron_insert_jobs(){
global $wpdb, $jr_log;
$sql = $wpdb->prepare("INSERT INTO wp_term_relationships select * from wp_new_term_relationships");
$wpdb->query($sql);
// and another sql query to delete all data from the table "wp_new_term_relationships"
}
add_action('init', 'jr_cron_insert_jobs');
此功能無法正常工作,具有MySQL數據庫我有這個警告,我的error_log沒有影響
警告:缺少參數2 :: WPDB準備()
,所以我需要有人來修改它,我
那麼,你的問題是什麼? – eggyal
這個功能不起作用我不知道爲什麼? – user1921704
我認爲你不能在這種情況下使用準備的方法,http://codex.wordpress.org/Class_Reference/wpdb –