I read the code and @aomari (reply on the previos page) is right.

This fonction does not make sense:

function set_pack_data( $pack_id ) {
global $wpdb;

if ( ! $pack_id )...