get($currentUserId); if (!isset($user_view->agencyId)) { $user_view->agencyId = $currentUserId; $user_view->agencyName = $user_view->agency_name; } $agency_id = (int) $user_view->agencyId; $post = clearInputData($_POST); $tableName = $post['name']; if ($tableName === '') { $tableName = 'Новая таблица'; } $tableType = (int) $post['type']; $funnelsJSON = $post['funnels']; $addFieldsJSON = $post['addFields']; mysql_query("INSERT INTO stat_tables (`agency_id`, `name`, `type`, `json_funnel`, `json_add`) " . "VALUES ($agency_id, '$tableName', $tableType, '$funnelsJSON', '$addFieldsJSON')");