--- a/heartbeat.admin.inc
+++ b/heartbeat.admin.inc
@@ -51,7 +51,7 @@
     array('data' => t('Time'), 'field' => 'timestamp', 'sort' => 'desc'),
     array('data' => t('Operations'))
   ));
-  $result = pager_query('SELECT DISTINCT ha.message AS \'message\', ha.uaid, ha.timestamp, ha.language, u.name AS registered_name, u.uid FROM {heartbeat_activity} ha LEFT JOIN {users} u ON u.uid = ha.uid '. tablesort_sql($form['header']['#value']), 50, 0, NULL);
+  $result = pager_query('SELECT DISTINCT ha.message AS message, ha.uaid, ha.timestamp, ha.language, u.name AS registered_name, u.uid FROM {heartbeat_activity} ha LEFT JOIN {users} u ON u.uid = ha.uid '. tablesort_sql($form['header']['#value']), 50, 0, NULL);
 
   // build a table listing the appropriate comments
   $destination = drupal_get_destination();

--- a/heartbeat.common.inc
+++ b/heartbeat.common.inc
@@ -229,7 +229,7 @@
   // Messages that were created before locale was installed,
   // need a record in the translation table.
   else {
-    db_query("INSERT INTO {heartbeat_translations} SET uaid = %d, tuaid = %d", $uaid, $uaid);
+    db_query("INSERT INTO {heartbeat_translations} (uaid, tuaid) VALUES (%d, %d)", $uaid, $uaid);
     return $uaid;
   }
 }

--- a/includes/heartbeataccess.inc
+++ b/includes/heartbeataccess.inc
@@ -252,13 +252,13 @@
     // If users are involved (uid or uid_target) in heartbeat_activity
     // check if they are not blocked (status = 1).
     $this->stream->sql_start = "SELECT
-      hm.hid AS 'hid', hm.message AS 'message_orig',
-      hm.message_concat AS 'message_concat_orig',
-      hm.attachments AS 'attachments', hm.concat_args,
-      hm.custom AS 'custom', hm.description as 'description',
-      hm.perms, hm.variables AS 'variables_orig',
+      hm.hid AS hid, hm.message AS message_orig,
+      hm.message_concat AS message_concat_orig,
+      hm.attachments AS attachments, hm.concat_args,
+      hm.custom AS custom, hm.description as description,
+      hm.perms, hm.variables AS variables_orig,
       ua.*, ua_users.*,
-      1 AS 'count'
+      1 AS count
     FROM {heartbeat_activity} ua
     LEFT JOIN {heartbeat_messages} hm ON ua.message_id = hm.message_id
     LEFT JOIN {users} ua_users ON ua.uid = ua_users.uid

--- a/includes/heartbeatactivity.inc
+++ b/includes/heartbeatactivity.inc
@@ -382,7 +382,7 @@
       if ($uaid && !isset($tuaid)) {
         $tuaid = $uaid;
       }
-      db_query("INSERT INTO {heartbeat_translations} SET tuaid=%d, uaid=%d", $tuaid, $uaid);
+      db_query("INSERT INTO {heartbeat_translations} (tuaid, uaid) VALUES (%d, %d)", $tuaid, $uaid);
 
     }
 
@@ -426,9 +426,8 @@
 
     // Log relational message to user activity
     $logged = db_query("INSERT INTO {heartbeat_activity}
-      SET uid=%d, uid_target=%d, nid=%d, nid_target=%d, message_id='%s', language='%s',
-      access = %d, message ='%s',message_concat ='%s', timestamp=%d
-      , nid_info='%s', nid_target_info='%s', uaid_comments=%d, variables='%s'",
+      (uid, uid_target, nid, nid_target, message_id, language, access, message, message_concat, timestamp, nid_info, nid_target_info, uaid_comments, variables)
+      VALUES  (%d, %d, %d, %d, '%s', '%s', %d, '%s', '%s', %d, '%s', '%s', %d, '%s')",
       $this->uid,  $this->uid_target, $this->nid, $this->nid_target, $this->message_id, $lang,
       $this->access, $message, $message_concat, $this->timestamp,
       serialize($this->nid_info), serialize($this->nid_target_info), 0,

--- a/includes/singleheartbeat.inc
+++ b/includes/singleheartbeat.inc
@@ -55,13 +55,13 @@
     // If users are involved (uid or uid_target) in heartbeat_activity
     // check if they are not blocked (status = 1).
     $this->stream->sql_start = "SELECT
-      hm.hid AS 'hid', hm.message AS 'message_orig',
-      hm.message_concat AS 'message_concat_orig',
-      hm.attachments AS 'attachments', hm.concat_args,
-      hm.custom AS 'custom', hm.description as 'description',
-      hm.perms, hm.variables AS 'variables_orig',
+      hm.hid AS hid, hm.message AS message_orig,
+      hm.message_concat AS message_concat_orig,
+      hm.attachments AS attachments, hm.concat_args,
+      hm.custom AS custom, hm.description as description,
+      hm.perms, hm.variables AS variables_orig,
       ua.*, ua_users.*,
-      1 AS 'count'
+      1 AS count
     FROM {heartbeat_activity} ua
     LEFT JOIN {heartbeat_messages} hm ON ua.message_id = hm.message_id
     LEFT JOIN {users} ua_users ON ua.uid = ua_users.uid

--- a/modules/friendlist_activity/friendlist_activity.module
+++ b/modules/friendlist_activity/friendlist_activity.module
@@ -123,7 +123,7 @@
 
   if ($api == 'friendlist_api') {
 
-    $sql = "SELECT fr.requestee_id as 'uid' FROM {friendlist_relations} as fr
+    $sql = "SELECT fr.requestee_id as uid FROM {friendlist_relations} as fr
     INNER JOIN {friendlist_statuses} fs ON fs.rid = fr.rid
     WHERE fr.requester_id = %d AND fs.status = '%s' ORDER BY fs.last_update_time DESC, fr.rid DESC";
     $result = db_query($sql, $uid, 'TW_BOTH');

--- a/modules/heartbeat_comments/heartbeat_comments.admin.inc
+++ b/modules/heartbeat_comments/heartbeat_comments.admin.inc
@@ -45,7 +45,7 @@
     array('data' => t('Reacted on'), 'field' => 'heartbeat_title'),
     array('data' => t('Time'), 'field' => 'timestamp', 'sort' => 'desc')
   ));
-  $result = pager_query('SELECT c.hcid, c.uid, c.uaid, c.message AS \'subject\', c.cleared, c.time, ha.message AS \'heartbeat_title\', u.name AS registered_name, u.uid  FROM {heartbeat_comments} c LEFT JOIN {heartbeat_activity} ha ON ha.uaid = c.uaid LEFT JOIN {users} u ON u.uid = c.uid '. tablesort_sql($form['header']['#value']), 50, 0, NULL);
+  $result = pager_query('SELECT c.hcid, c.uid, c.uaid, c.message AS subject, c.cleared, c.time, ha.message AS heartbeat_title, u.name AS registered_name, u.uid  FROM {heartbeat_comments} c LEFT JOIN {heartbeat_activity} ha ON ha.uaid = c.uaid LEFT JOIN {users} u ON u.uid = c.uid '. tablesort_sql($form['header']['#value']), 50, 0, NULL);
 
   // build a table listing the appropriate comments
   $destination = drupal_get_destination();

--- a/modules/heartbeat_comments/heartbeat_comments.module
+++ b/modules/heartbeat_comments/heartbeat_comments.module
@@ -515,7 +515,7 @@
 
     if (db_query("INSERT INTO {heartbeat_comments} (uid, uaid, message, time) VALUES (%d, %d, '%s', '%s')", $uid, $tuaid, $message, date('Y-m-d H:i:s'))) {
       $hcid = db_last_insert_id('heartbeat_comments', 'hcid');
-      $saved = db_fetch_object(db_query("SELECT s.hcid, s.uid, s.uaid, s.message AS 'comment', s.time,
+      $saved = db_fetch_object(db_query("SELECT s.hcid, s.uid, s.uaid, s.message AS comment, s.time,
         u.uid, u.name AS registered_name, u.name AS name, u.signature, u.signature_format, u.picture, u.data
         FROM {heartbeat_comments} s INNER JOIN {users} u ON s.uid = u.uid
         WHERE s.hcid = %d", $hcid));
@@ -737,7 +737,7 @@
   // a translation that is not there, consequently.
   // That is hard coded taken care of while saving the comment.
   if ($locale) {
-    $query = "SELECT s.hcid, s.uid, s.message AS 'comment', s.cleared, s.time, u.uid,
+    $query = "SELECT s.hcid, s.uid, s.message AS comment, s.cleared, s.time, u.uid,
       u.name, u.signature, u.signature_format, u.picture, u.data, ht.tuaid
       FROM {heartbeat_comments} s INNER JOIN {users} u ON s.uid = u.uid
       INNER JOIN {heartbeat_activity} ha ON ha.uaid = s.uaid
@@ -745,7 +745,7 @@
       WHERE ht.uaid = %d ORDER BY time DESC";
   }
   else {
-    $query = "SELECT s.hcid, s.uid, s.message AS 'comment', s.cleared, s.time,
+    $query = "SELECT s.hcid, s.uid, s.message AS comment, s.cleared, s.time,
       u.uid, u.name, u.signature, u.signature_format, u.picture, u.data
       FROM {heartbeat_comments} s INNER JOIN {users} u ON s.uid = u.uid
       WHERE uaid = %d ORDER BY time DESC";

--- a/modules/og_activity/groupsactivity.inc
+++ b/modules/og_activity/groupsactivity.inc
@@ -42,13 +42,13 @@
 
     // Sql parts
     $this->stream->sql_start = "SELECT
-      hm.hid AS 'hid', hm.message AS 'message_orig',
-      hm.message_concat AS 'message_concat_orig',
-      hm.attachments AS 'attachments', hm.concat_args,
-      hm.custom AS 'custom', hm.description as 'description',
-      hm.perms, hm.variables AS 'variables_orig',
+      hm.hid AS hid, hm.message AS message_orig,
+      hm.message_concat AS message_concat_orig,
+      hm.attachments AS attachments, hm.concat_args,
+      hm.custom AS custom, hm.description as description,
+      hm.perms, hm.variables AS variables_orig,
       ua.*,
-      1 AS 'count'
+      1 AS count
     FROM {heartbeat_activity} ua
     LEFT JOIN {heartbeat_messages} hm ON ua.message_id = hm.message_id
     INNER JOIN {og_ancestry} oa ON (oa.nid = ua.nid OR oa.group_nid = ua.nid)
