Rules data selection tokens I have a rules data selection token that looks like this
[order:products:0:node:author:uid]
In data selection mode that works perfectly, and adds the exact data right where I need it.
But when I am trying to add that kind of token into the mysql with this, using "execute custom php code" inside that rule using this code

$nid = db_insert('mytable') -&gt;fields(array(
  'uid' =&gt; $uid,
  'username' =&gt; $username,
  'addr' =&gt; $address,
  'destination' =&gt; "[order:products:0:node:author:uid]"
))
-&gt;execute();


I am getting no error as a response, but only a blank field 'destination' with no value in mysql. All the other fields are filling correctly. What could possibly be a problem here?
You might want to use token_replace.

You can use it like this:

$token = token_replace('[order:products:0:node:author:uid]', array('order' =&gt; $order));


So $order is your order.