Sunday, May 31, 2009

A problem with a DISTINCT

Hey guys, i'm trying to do this, but i can't get to work:

function verclones($id){

$this->layout = "limpio";

$clones=$this->Visitante->query("SELECT DISTINCT usuario_id FROM
visitantes WHERE ip=(SELECT ip FROM visitantes WHERE usuario_id=$id
ORDER BY ip DESC LIMIT 1)");

$this->set("clones",$clones);
}


In the view file i put this:

<?php foreach($clones as $clon):?>

<?php echo $clon;?>

<?php endforeach;?>

But it returns the word "Array".

What i'm doing wrong? Can somebody help me? Thank u! Love this group.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

No comments: