- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
$s = $this->getAdapter()->select()->from(array('b' => $this->info('name'), array(
'text',
'link',
'image',
'show_register',
)))->joinInner(array('s' => 'banner_size'), 's.id=b.size_id', array('x', 'y'))
->where('b.show_it = ?', 1)
->where('s.x = ?', $sizeX)
->where('s.y = ?', $sizeY)
->limit(1)
->order('RAND()');
if (!empty($uid)){
$s->where('(b.show_register= ?, 1)' OR '(b.show_register= ?, 0)');
} else {
$s->where('(b.show_register= ?, -1)' OR '(b.show_register= ?, 0)');
}
echo $s-> __toString();
// var_dump(!empty($uid));
return $this->getAdapter()->fetchRow($s);