title: Writing data into database table issue
body: <p>I have function that has to write some data into database table, but after function complete, i dont see added info in my phpmyadmin. Here is code of what am i trying to run</p>
  
  <pre><code>function q_cart_add($node) {
      global $user;
      //drupal_set_title('Добавление товара в корзину');
      drupal_set_title('Товар добавлен в корзину');
      if (!user_access('add to cart'))
          return '&lt;p&gt;У вас не достаточно прав для добавления в корзину&lt;/p&gt;';
      if ($node-&gt;type != 'kartochka')
          return '&lt;p&gt;В корзину можно положить только товар&lt;/p&gt;';
      $added = false;
      if ($user-&gt;uid) {
          $added = db_result(db_query('SELECT `added` FROM {q_cart} WHERE `uid` = %d OR `nid` = %d', $user-&gt;uid, $node-&gt;nid));
          if (!$added) {
              db_query('INSERT INTO {q_cart} (`uid`, `nid`, `added`) VALUES (%d, %d, %d)', $user-&gt;uid, $node-&gt;nid, time());
          }
      } else {
          foreach (isset($_COOKIE['q_cart']) &amp;&amp; ($cart = json_decode($_COOKIE['q_cart'])) ? $cart : array() as $item)
              if ($item-&gt;nid == $node-&gt;nid) {
                  $added = true;
                  break;
              }
          if (!$added) {
              $cart[] = array(
                  'nid'   =&gt; $node-&gt;nid,
                  'added' =&gt; time(),
              );
              setcookie('q_cart', json_encode($cart), strtotime('+1 week'), '/');
          }
      }
      //if (!$added) return '&lt;p&gt;Товар добавлен в корзину.&lt;/p&gt;'.l('Корзина', 'cart', array('attributes' =&gt; array('target' =&gt; '_top', 'class' =&gt; 'button-link'))).'&lt;a href="javascript://" onclick="parent.Lightbox.end(\'forceClose\');" class="button-link"&gt;Позже&lt;/a&gt;';
      if (!$added) {
          drupal_add_js('$(document).ready(function(){parent.document.getElementById("bottomNavClose").style.display = "none";parent.document.getElementById("lightbox").style.top = "200px";});', 'inline');
          return l('Корзина', 'cart', array('attributes' =&gt; array('target' =&gt; '_top', 'class'  =&gt; 'button-link'))) .
                  '&lt;a href="/node/' . $node-&gt;nid . '" target ="_top" class="button-link"&gt;Позже&lt;/a&gt;';
          //'&lt;a href="javascript://" onclick="parent.Lightbox.end(\'forceClose\');" class="button-link"&gt;Позже&lt;/a&gt;';
      } else {
          return '&lt;p&gt;Товар уже есть в вашей корзине.&lt;/p&gt;';
      }
  }
  </code></pre>