你可以用$last_item = $wpdb->get_row( "SELECT * FROM $wpdb->wp_puzzle ORDER BY your_table_id DESC LIMIT 1", ARRAY_A );
并在表格中手动输入每个项目
public function puzzle_manager(){
global $wpdb;
$file = file_get_contents(\'puzzle_manager.php\', FILE_USE_INCLUDE_PATH);
if($file == false){
echo \'file not found\';
}
else{
echo $file;
}
$last_item = $wpdb->get_row( "SELECT * FROM $wpdb->wp_puzzle ORDER BY your_table_id DESC LIMIT 1", ARRAY_A );
if(!empty($last_item)){
echo \'<pre>\';
print_r_($last_item);
//you must put manualy every $last_item value in your form, example $last_item[\'puzzle_title\'] in puzzle_title input
echo \'</pre>\';
}
$default = array(
\'puzzle_title\' => \'\',
\'image\' => \'\',
\'rows\' => \'\',
\'cols\' => \'\',
\'timer\' => \'\',
\'movements_counter\' => \'\',
\'original_button\' => \'\',
\'numbers_button\' => \'\',
);
$item = shortcode_atts( $default, $_REQUEST );
$wpdb->insert( \'wp_puzzle\' , $item );
}