Can someone please tell why this Memcache / PHP code doesn't work?

Hi,
The parts which are commented out do work, the rest (which I need does not work), why?

[SIZE=“1”]Original source = Using Memcache with MySQL and PHP
http://pureform.wordpress.com/2008/05/21/using-memcache-with-mysql-and-php/[/SIZE]


<?php
/*

// Stats do work --> Memcache is good to go...
$memcache = new Memcache;
    $memcache->connect("localhost",12xxx);
    $memcache->flush();
    print_r($memcache->getStats());

*/


    # Connect to memcache:
    global $memcache;
    $memcache = new Memcache;
    $memcache->connect("localhost",12xxx);

// Not sure if I set a 'key' or if memcache does / Does not seem to work either way.. 
$key=1234567;

    # Gets key / value pair into memcache ... called by mysql_query_cache()
    function getCache($key) {
        global $memcache;
        return ($memcache) ? $memcache->get($key) : false;
    }

    # Puts key / value pair into memcache ... called by mysql_query_cache()
    function setCache($key,$object,$timeout = 60) {
        global $memcache;
        return ($memcache) ? $memcache->set($key,$object,MEMCACHE_COMPRESSED,$timeout) : false;
    }

    # Caching version of mysql_query()
    function mysql_query_cache($sql,$linkIdentifier = false,$timeout = 60) {
        if (($cache = getCache(md5("mysql_query" . $sql))) !== false) {
            $cache = false;
            $r = ($linkIdentifier !== false) ? mysql_query($sql,$linkIdentifier) : mysql_query($sql);
            if (is_resource($r) && (($rows = mysql_num_rows($r)) !== 0)) {
                for ($i=0;$i<$rows;$i++) {
                    $fields = mysql_num_fields($r);
                    $row = mysql_fetch_array($r);
                    for ($j=0;$j<$fields;$j++) {
                        if ($i === 0) {
                            $columns[$j] = mysql_field_name($r,$j);
                        }
                        $cache[$i][$columns[$j]] = $row[$j];
                    }
                }
                if (!setCache(md5("mysql_query" . $sql),$cache,$timeout)) {
                    # If we get here, there isn't a memcache daemon running or responding
                }
            }
        }
        return $cache;
    }

//db connect...

    $sql = "SELECT * FROM `all1`.`mybb_users` "; 

/*

// "Normal" way works....
    # Before: [without memcache]
    $rSlowQuery = mysql_query($sql);
    # $rSlowQuery is a MySQL resource
    $rows = mysql_num_rows($rSlowQuery);
    for ($i=0;$i<$rows;$i++) {
        $dataID = intval(mysql_result($rSlowQuery,$i,"uid"));
        $dataTitle = mysql_result($rSlowQuery,$i,"username");

        echo "<a href=\\"/somewhere/$dataID\\">$dataTitle</a><br />\
";
    }

*/

// The "with memcache" section, gives blank page;  Will check error logs soon...

    # After: [with memcache]
    $rSlowQuery = mysql_query_cache($sql);
    # $rSlowQuery is an array
    $rows = count($rSlowQuery);
    for ($i=0;$i<$rows;$i++) {
        $dataID = intval($rSlowQuery[$i]["uid"]);
        $dataTitle = $rSlowQuery[$i]["username"];

        echo "<a href=\\"/somewhere/$dataID\\">$dataTitle</a><br />\
";
   }

?>

Can someone please tell why this Memcache / PHP code doesn’t work?
Thank you.

Umm, silly question perhaps, but you do have a memcache server to connect to, right?