Selasa, 01 Mei 2012 - 20:20:20 WIB
Teknik Looping Didalam Looping Disertai Studi Kasusnya
Diposting oleh : Wiro Sableng
Kategori: Umum - Dibaca: 401300 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.

    17445 Komentar :

    payday loan with no debit card uk
    17 Februari 2017 - 08:38:35 WIB

    In the case of secured finance, the agencies help keep any property or asset as security.
    Such things as prepayment penalties, interest amounts and then for any other fee included will directly impact on your repayment ability.
    Car title loan borrowers will be able to sue title lenders and void contracts
    that violate the law.
    Cheap Payday Loans Ca
    17 Februari 2017 - 09:14:25 WIB

    A bank-account must be possessed on the name which should be 3
    to 6 months older. These loans are only for those poor credit
    holders who're facing troubles in repaying their multiple debts.
    Bad credit loans can be obtained to everyone people struggling with credit problems like arrears, payment default, and overdue or county court judgments against their name.
    wells fargo online banking personal login
    17 Februari 2017 - 09:20:53 WIB

    British advocates of leaving believe the country is being held back through the political and
    economic union. Elaine Chao is certain being confirmed as President-elect
    Donald Trump's secretary of transportation, but that will
    not her only way to obtain income when the newest administration takes over.
    cara mengobati stroke
    17 Februari 2017 - 09:27:43 WIB

    ijin menyimak artikelnya pak admin
    phone psychic reading
    17 Februari 2017 - 10:08:29 WIB

    I can’t recall the last time I really enjoyed an article as much as this one.
    You have gone beyond my expectations on this topic and I agree with your points.

    You have done well with this.
    17 Februari 2017 - 12:47:10 WIB

    Wow, this post is fastidious, my younger sister is analyzing these
    kinds of things, so I am going to let know her.
    phone psychic reading
    17 Februari 2017 - 13:08:03 WIB

    Very good posts from you, fella. I’ve understand your point and
    you’re simply extremely great. I enjoy what you have here, actually like what you’re stating
    and also the way in which you say it. You make it enjoyable.
    I cant wait to read much more from you. This is truly an excellent website.
    17 Februari 2017 - 15:32:33 WIB

    Hi there, just became aware of your blog through Google, and found that it's truly
    informative. I am gonna watch out for brussels.
    I?ll appreciate if you continue this in future.

    Lots of people will be benefited from your writing. Cheers!
    phone psychic reading
    17 Februari 2017 - 15:36:24 WIB

    I merely desired to thank you a lot more for your amazing website you have developed
    here. It's full of beneficialsuggestions for
    those who are actually interested in this kind of subject, mainly
    this post.
    phsycic readings
    17 Februari 2017 - 15:49:14 WIB

    Thanks for this post, I'm a huge fan of this site would want to be
    << First | < Prev | ... 1739 | 1740 | 1741 | 1742 | 1743 | ... | 1745 | Next > | Last >>
    Isi Komentar :
    Nama :
    Website :
     (Masukkan 6 kode diatas)