Yii Framework Forum: Search () - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Search () Rate Topic: -----

#1 User is offline   kfahmi 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 81
  • Joined: 19-March 12

Posted 09 July 2012 - 04:35 AM

ane punya tabel database nih om.

tbl_calo => (id_calo, nama_calo)

tbl_anggota => (id_anggota, id_calo, nama_anggota)

tbl_tagihan => (id_tagihan, id anggota, Harga)

Nah ane lagi fokus belajar2 di TAGIHAN nih, tapi bingung :(

dihalaman admin (TAGIHAN) kan ada advanced search dan gridview bawaan yii.
ane mau buat di fungsi searchnya buat nyari tagihan anggota yang memiliki id_calo = misalnya 20.

ini script search() ane, Standard bgt

public function search()
{
$criteria=new CDbCriteria;
		$criteria->compare('id_tagihan',$this->id_tagihan);
		$criteria->compare('id_anggota',$this->id_anggota);
		$criteria->addBetweenCondition('pembayaran',$this->date1,$this->date2);
		$criteria->compare('id_jt',$this->id_jt);
		$criteria->compare('status',$this->status);
		$criteria->compare('notes',$this->notes,true);
		$criteria->compare('tagihan',$this->tagihan,true);
		$criteria->order = ('id_tagihan DESC');

return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
                    'pagination'=>array('pageSize'=>$this->pagesize),
		));
}

0

#2 User is offline   mbahsomo 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 40
  • Joined: 29-March 10

Posted 20 July 2012 - 07:12 PM

Wah terimakasih mas. tambah ilmu ini
Sugik Puja Kusuma [mbahsomo]
http://sugik.do-event.com
0

#3 User is offline   teguh11 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 129
  • Joined: 13-November 11

Posted 07 August 2012 - 11:03 PM

ini apaan yang mau ditanyain??
belajar itu mudah..
0

#4 User is offline   aqge 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 188
  • Joined: 02-September 10
  • Location:Indonesia

Posted 09 August 2012 - 02:29 AM

View Postkfahmi, on 09 July 2012 - 04:35 AM, said:

ane punya tabel database nih om.

tbl_calo => (id_calo, nama_calo)

tbl_anggota => (id_anggota, id_calo, nama_anggota)

tbl_tagihan => (id_tagihan, id anggota, Harga)

Nah ane lagi fokus belajar2 di TAGIHAN nih, tapi bingung :(

dihalaman admin (TAGIHAN) kan ada advanced search dan gridview bawaan yii.
ane mau buat di fungsi searchnya buat nyari tagihan anggota yang memiliki id_calo = misalnya 20.

ini script search() ane, Standard bgt

public function search()
{
$criteria=new CDbCriteria;
		$criteria->compare('id_tagihan',$this->id_tagihan);
		$criteria->compare('id_anggota',$this->id_anggota);
		$criteria->addBetweenCondition('pembayaran',$this->date1,$this->date2);
		$criteria->compare('id_jt',$this->id_jt);
		$criteria->compare('status',$this->status);
		$criteria->compare('notes',$this->notes,true);
		$criteria->compare('tagihan',$this->tagihan,true);
		$criteria->order = ('id_tagihan DESC');

return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
                    'pagination'=>array('pageSize'=>$this->pagesize),
		));
}




mungkin bisa begini
$criteria->with= array('anggota');
$criteria->compare('anggota.id_calo',$this->anggota->id_calo,true);


Best Regard
Tidak ada coding yang salah
Yang ada hanyalah Coding yang lebih baik
0

#5 User is offline   mbahsomo 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 40
  • Joined: 29-March 10

Posted 09 August 2012 - 10:51 PM

wah bisa di coba nanti
Sugik Puja Kusuma [mbahsomo]
http://sugik.do-event.com
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users