prefix . "admanager"; $id = $wpdb->get_var( $wpdb->prepare( " SELECT id FROM `".$table_name."` ORDER BY id DESC limit 0,1 " )); $short_code = "admanager-".$id+1; $wpdb->insert( $table_name, //table array('title' => $title, 'ad_image' => $image, 'target_url' => $target_url, 'div_width' => $width, 'div_height' => $height, 'short_code' => $short_code, 'created_date' => $created_date, 'status' => $status) ); $message.="Ad inserted successfully."; } ?>