Index: civicrm_drupal_username_sync.module
===================================================================
--- civicrm_drupal_username_sync.module	(revision 2032)
+++ civicrm_drupal_username_sync.module	(working copy)
@@ -57,19 +57,19 @@
       // To check if the CiviCRM contact present.
       if ($contact) {
         // To check the entry is present in the custom table.
-        $querySel = "SELECT %1 FROM %2 WHERE entity_id = %3";
-        $selectParams = array(1 => array($customData['column'], 'String'), 2 => array($tableName, 'String'), 3 => array($contact, 'Integer'));
+        $querySel = "SELECT {$customData['column']} FROM $tableName WHERE entity_id = %1";
+        $selectParams = array(1 => array($contact, 'Integer'));
         $daoSel  = & CRM_Core_DAO::executeQuery($querySel, $selectParams);
                         
         $row = array();
         if ($daoSel->fetch()) {
-          $queryUp = "UPDATE %1 SET %2 = %3 WHERE entity_id = %4";
-          $upParams = array(1 => array($tableName, 'String'), 2 => array($customData['column'], 'String'), 3 => array($user->name, 'String'), 4 => array($contact, 'Integer'));
+          $queryUp = "UPDATE $tableName SET {$customData['column']} = %1 WHERE entity_id = %2";
+          $upParams = array(1 => array($user->name, 'String'), 2 => array($contact, 'Integer'));
           $daoUp   = & CRM_Core_DAO::executeQuery($queryUp, $upParams);
         }
         else {
-          $queryIns = "INSERT INTO %1 (entity_id, %2) VALUES (%3, %4)";
-          $insParams = array(1 => array($tableName, 'String'), 2 => array($customData['column'], 'String'), 3 => array($contact, 'Integer'), 4 => array($user->name, 'String'));
+          $queryIns = "INSERT INTO $tableName (entity_id, {$customData['column']}) VALUES (%1, %2)";
+          $insParams = array(1 => array($contact, 'Integer'), 2 => array($user->name, 'String'));
           $daoIns   = & CRM_Core_DAO::executeQuery($queryIns, $insParams);
         }
       }
