1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
|
public static function findAmi($id)
{
$db = Zend_Db_Table_Abstract::getDefaultAdapter();
$select = $db->select()
->from(array('A' => 'ami'),array('M.id','M.description','M.nomp' ,'M.prenomn','M.id_contenu','N.id','N.description','N.nomp' ,'N.prenomn','N.id_contenu',))
->distinct()
->joinLeft(array('M' => 'membres'),'A.id_membre1 = M.id',array())
->joinLeft(array('N' => 'membres'),'A.id_membre2 = N.id',array())
->where('N.id = ? or M.id = ?', $id)
->where('A.etat=?',1)
->order(array('M.nomp DESC',
'N.nom DESC'));
$stmt = $db->query($select);
return $row = $stmt->fetchAll();
} |
Partager