•  
  • YAYASAN PENDIDIKAN HARAPAN BANGSA DUMAI
Senin, 01 Mei 2017 - 20:20:20 WIB
Teknik Looping Didalam Looping Disertai Studi Kasusnya
Diposting oleh : Administrator
Kategori: Teknologi - Dibaca: 34179 kali

Dalam logika pemrograman, looping (perulangan) digunakan untuk mengulang suatu proses. Namun, dalam tutorial kali ini, saya tidak akan membahas dasar-dasar looping (perulangan), jadi saya langsung aja ke permasalahannya mengapa diperlukan looping didalam looping? Dalam kasus tertentu, looping saja tidaklah cukup, misalnya membuat rekap data yang kompleks dari beberapa tabel dan menampilkan masing-masing berita dalam suatu kategori. Dalam kedua kasus tersebut diperlukan looping didalam looping (while didalam while).

Agar tidak tambah bingung, saya akan berikan contohnya secara bertahap, biasanya dalam menampilkan data dalam suatu tabel kategori hanya diperlukan satu looping, contoh skripnya sebagai berikut:

 

Apabila dijalankan di browser, maka hasilnya dapat dilihat pada gambar berikut:

Selanjutnya, kita akan menampilkan beberapa berita didalam masing-masing kategori. Logikanya, setelah looping (while) untuk menampilkan kategori, maka perlu diselipkan satu looping lagi untuk menampilkan berita didalam looping kategori. Dan tentu saja, berita yang tampil haruslah berhubungan dengan kategorinya.

Untuk itu, coba perhatikan dulu relasi antara tabel kategori dengan tabel berita pada gambar berikut:

Kemudian baru kita bikin skripnya sebagai berikut:

 

Sekarang coba jalankan di browser, maka hasilnya dapat dilihat pada gambar berikut:

Saya juga telah mengimplementasikan teknik looping didalam looping di CMS Lokomedia pada templates eL jQuery ala Yahoo, silahkan buka file kiri.php pada folder templates/eljquery-yahoo. Hasilnya dapat dilihat pada gambar berikut:

Oke, demikianlah sekilas kegunaan teknik looping dalam looping. Untuk mendownload skrip dan database latihannya, silahkan Klik Disini.



2070 Komentar :

kitchen organization ideas
17 Mei 2018 - 15:33:59 WIB

hey there and thank you for your info ? I have definitely picked up anything new from right here.
I did however expertise a few technical issues using this website,
since I experienced to reload the site a lot of times previous to I could
get it to load correctly. I had been wondering if your web host is OK?
Not that I'm complaining, but slow loading instances times will sometimes affect
your placement in google and can damage your high-quality
score if advertising and marketing with Adwords. Anyway I'm adding this RSS
to my e-mail and could look out for a lot more of your respective fascinating content.
Make sure you update this again soon.
kitchen organization ideas
17 Mei 2018 - 15:37:50 WIB

Hi there i am kavin, its my first time to commenting anyplace,
when i read this post i thought i could also make comment due to this sensible paragraph.
IKEA Bathroom Organizing Hacks
17 Mei 2018 - 15:40:59 WIB

I wanted to thank you for this great read!! I certainly loved every little bit of it.

I have got you bookmarked to look at new stuff you post?
Small Space Entryway Decorating Ideas
17 Mei 2018 - 15:43:48 WIB

Thanks for sharing your thoughts on google. Regards
Ikea Hacks for Kallax Shelf
17 Mei 2018 - 16:21:00 WIB

Aw, this was a really good post. Spending some time and actual effort to
produce a very good article? but what can I say?
I procrastinate a whole lot and don't manage to get nearly anything done.
gambar pantai kata pariaman
17 Mei 2018 - 16:49:34 WIB

Greetings! Very helpful advice in this particular article!

It is the little changes that produce the greatest changes.

Thanks for sharing!
IKEA Bathroom Organizing Hacks
17 Mei 2018 - 16:52:02 WIB

I needed to thank you for this excellent read!! I definitely enjoyed every bit of it.
I have you book marked to check out new things you post?
alamat green tea holic
17 Mei 2018 - 16:53:22 WIB

I like the valuable information you provide on your articles.

I will bookmark your blog and check once more here frequently.
I am fairly certain I'll be informed plenty of new stuff
proper here! Good luck for the next!
Ikea Hacks for Kallax Shelf
17 Mei 2018 - 17:04:32 WIB

I needed to thank you for this very good read!! I
definitely loved every little bit of it. I've got you book-marked to check out new things you post?
pantai karanggongso trenggalek
17 Mei 2018 - 17:04:51 WIB

Because the admin of this web site is working, no
question very shortly it will be famous, due to its feature contents.
<< First | < Prev | ... 171 | 172 | 173 | 174 | 175 | ... | 207 | Next > | Last >>

Isi Komentar :
Nama :
Website :
Komentar
 
 (Masukkan 6 kode diatas)