<!DOCTYPE html>
<html><head>
    <meta charset="UTF-8">
</head><body><p>I wrote this code snippet:</p><pre class="lang-erlang prettyprint prettyprinted"><em>Player=t:user(List),
        CatchAll=[{'_',[],['$_']}],
        NameList=mnesia:dirty_select(player, CatchAll),
          if
              (length(NameList)<4)->
                  T3 = fun() ->
                  X3 = #player{name=Player
                                },
                      mnesia:write(X3)
                      end,
                      mnesia:transaction(T3),
                  NameList1=mnesia:dirty_select(player, CatchAll),
                  ?io:format("1The value of NameList1 is ~p~n",[NameList1]),
                  ok;
              (length(NameList)==4)->
                  ?io:format("2The value of NameList is ~p~n",[NameList])
          end,       </em></pre><p>Here, each time a call a module t:user I get a name which i have stored in Player and want to keep storing these names till there are 4 of them but each i time I run this I get an empty value of Namelist as [], instead of a list filled with players name.</p><p>Any Idea on why this is happening?</p></body></html>