Index: trunk/wp-content/plugins/xpressme/include/custom_functions.php
===================================================================
--- trunk/wp-content/plugins/xpressme/include/custom_functions.php	(revision 51)
+++ trunk/wp-content/plugins/xpressme/include/custom_functions.php	(revision 54)
@@ -218,5 +218,5 @@
 // Retrieves post views given a post ID or post object. 
 function xpress_post_views_count($post_id=0,$format= '',$show = true) {
-	global $table_prefix;
+	global $xoops_db;
 
 	static $post_cache_views;
@@ -230,10 +230,10 @@
 	if($post_id==0) return null;
 	if(!isset($post_cache_views[$post_id])){
-        $sql = "SELECT post_views FROM " . $table_prefix . "views" . " WHERE post_id=$post_id";
-        if (!$result = $GLOBALS["xoopsDB"]->query($sql)) {
+        $sql = "SELECT post_views FROM " . get_xoops_prefix() . "views" . " WHERE post_id=$post_id";
+        $post_views = $xoops_db->get_var($sql);
+        if (!$post_views) {
 	        $post_cache_views[$post_id] = 0;
         }else{
-	        $row = $GLOBALS["xoopsDB"]->fetchArray($result);
-	        $post_cache_views[$post_id] = $row["post_views"];
+	        $post_cache_views[$post_id] = $post_views;
         }
 	}
