function update_item($id, $name, $description, $image = null, $price, $type_id)
{
    global $wpdb;
    $item_table = get_items_table_name();
    $params = array('name' => $name, 'description' => $description, 'price' => $price, 'type_id' => $type_id);
    if (!is_null($image)) {
        $params['image'] = $image;
    }
    $wpdb->update($item_table, $params, array('id' => $id));
}
function build_items_sql()
{
    $items_table = get_items_table_name();
    $item_types_table = get_item_types_table_name();
    $sql = "CREATE TABLE {$items_table} (\n    `id` int(10) NOT NULL AUTO_INCREMENT,\n    `name` varchar(30),\n    `description` text,\n    `image` varchar(80),\n    `price`  decimal(10, 2),\n    `type_id` int(10) NOT NULL,\n    PRIMARY KEY (`id`),\n    FOREIGN KEY (`type_id`) REFERENCES {$item_types_table}(`id`)\n    );";
    return $sql;
}