Swapping Column Values in MySQL

UPDATE swap_test SET state_id=district_id, district_id=@temp WHERE (@temp:=state_id) IS NOT NULL;

Above query is using temporary variable to swap values of column values and It is working properly. Although there is second query also available which is perfect way to do this and will work for NOT NULL and NULL both values.

UPDATE swap_test SET state_id=(@temp:=state_id), state_id = district_id, district_id = @temp;

Above query is perfect query to swap two column values with each other in Db table. I am sure there will be lots of other ways to do this and if you know any other better way then let us know in comments

Only allow posts by users with accounts more than two days old in Drupal

 * Implement hook_node_access().
 * Only allow posts by users with accounts more than two days old.
function delay_node_access($node, $op, $account) {
  if ($op != 'create' || $node != 'article') {
  if (empty($account->created) || $account->created > (REQUEST_TIME - (48 * 3600))) {
    return NODE_ACCESS_DENY;

Simple example of EntityFieldQuery in Drupal 7

A full EntityFieldQuery example. @see: http://drupal.org/node/1343708

$query = new EntityFieldQuery();

$query->entityCondition('entity_type', 'node')
  ->entityCondition('bundle', 'article')
  ->propertyCondition('status', 1)
  ->fieldCondition('field_news_types', 'value', 'spotlight', '=')
  ->fieldCondition('field_photo', 'fid', 'NULL', '!=')
  ->fieldCondition('field_faculty_tag', 'tid', $value)
  ->fieldCondition('field_news_publishdate', 'value', $year. '%', 'like')
  ->range(0, 10)
  ->addMetaData('account', user_load(1)); // Run the query as user 1.

$result = $query->execute();

if (isset($result['node'])) {
  $nids = array_keys($result['node']);
  $nodes = entity_load('node', $nids);