Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in /home/cuhhwsxi/public_html/web/config/koneksi.php on line 12
Teknik Looping Didalam Looping Disertai Studi Kasusnya
Get Adobe Flash player
My Profile
Pencarian

Polling

    Apa Browser Favorit Anda?

    Internet Explorer
    Mozilla Firefox
    Google Chrome
    Opera

    Lihat Hasil Poling

Statistik User
1657087
Pengunjung hari ini : 4574
Total pengunjung : 74730
Hits hari ini : 47361
Pengunjung Online : 206
Banner
Shoutbox


Nama :
Website :
Pesan :

Kata Mutiara
Komentar Terkini
  • Fleta Thank you for the good writeup. It in truth was once a enjoyment account it. Glance advanced to more added agreeable from you! However, how can we be in contact?

    - Pada Berita : Angry Birds Siap Hadirkan Budaya Indonesia
  • Tomoko Good post. I will be going through many of these issues as well..

    - Pada Berita : Digerus Firefox, IE Makin Melempem
  • Shani Hi there! I understand this is somewhat off-topic but I needed to ask. Does running a well-established website such as yours require a lot of work? I am completely new to blogging however I do write in my journal on a daily basis. I'd like to start a blog so I can easily share my personal experience and views online. Please let me know if you have any kind of ideas or tips for brand new aspiring bloggers. Appreciate it!

    - Pada Berita : Maria Kirilenko, Petenis Terseksi Versi WTA
  • 도깨비 7회 다시보기 What's up to every body, it's my first pay a quick visit of this website; this web site consists of awesome and really excellent stuff for visitors.

    - Pada Berita : Angry Birds Siap Hadirkan Budaya Indonesia
  • unit heating Hello very cool blog!! Guy .. Excellent .. Amazing .. I will bookmark your website and take the feeds additionally? I'm glad to find so many useful information right here in the submit, we want develop more strategies on this regard, thanks for sharing. . . . . .

    - Pada Berita : Angry Birds Siap Hadirkan Budaya Indonesia
  • togel online I've learn a few excellent stuff here. Definitely value bookmarking for revisiting. I surprise how much effort you put to make this sort of magnificent informative web site.

    - Pada Berita : Angry Birds Siap Hadirkan Budaya Indonesia
  • Ivf Patients You've made some decent points there. I looked on the internet for more information about the issue and found most people will go along with your views on this site.

    - Pada Berita : Terima Kasih Gayus Tambunan
  • Lovie I'm really enjoying the theme/design of your blog. Do you ever run into any browser compatibility problems? A number of my blog visitors have complained about my site not operating correctly in Explorer but looks great in Safari. Do you have any recommendations to help fix this problem?

    - Pada Berita : Angry Birds Siap Hadirkan Budaya Indonesia
  • forum.pencilandinkreviews.com I used to be suggested this blog by my cousin. I am not positive whether or not this post is written via him as no one else recognize such particular about my difficulty. You're amazing! Thank you!

    - Pada Berita : Angry Birds Siap Hadirkan Budaya Indonesia
  • Aspirateur Sans Sac Pas Cher Avis Le principe est easy : un aspirateur fixe, placée dans la cave ou le garage, avec des tuyaux qui passent dans les murs jusqu'à des prises poussières murales dans les différentes pièces.

    - Pada Berita : Angry Birds Siap Hadirkan Budaya Indonesia
Diposting oleh : Wiro Sableng Kategori: Teknologi - Dibaca: 16456 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:

<?php
include "koneksi.php";

echo "<h3>Daftar Kategori</h3>";

$kategori=mysql_query("select * from kategori");

while($k=mysql_fetch_array($kategori)){
  echo "<li>$k[nama_kategori]</li>";
}
?>

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:

<?php
include "koneksi.php";

$kategori=mysql_query("select * from kategori");

// looping untuk menampilkan nama kategori
while($k=mysql_fetch_array($kategori)){
  echo "<h3>$k[nama_kategori]</h3>";
  
  $berita=mysql_query("select * from 
  kategori, berita 
  where kategori.id_kategori=berita.id_kategori 
  and berita.id_kategori='$k[id_kategori]'");

// looping untuk menampilkan judul berita 
// yang berhubungan dengan kategori masing-masing
  while($b=mysql_fetch_array($berita)){
    echo "<li>$b[judul]</li>";
  } // end while looping berita
} // end while looping kategori
?>

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.






บ้านผลบอลทีเด็ด
22 Juni 2017 - 17:33:31 WIB

Do you have any video of that? I'd care to find out some additional information.
new.sexopedia.ru
22 Juni 2017 - 08:03:47 WIB

Here are a few benefits of internet dating you could possibly want to check into when you consider a great decision whether or not to date online.
The #1 good reason that online matchmaking is superior to traditional matchmaking depends upon one word: choices.

You may possess a habit of being really honest and you think mtss is a desired trait - so
it is, but when it comes to your dates you
are able to really hurt their feelings if you are
too blunt and honest.
http://www.jeuxvideo.com/forums/42-14466-51174883-1-0-1-0-no-survey-pes-2017-hack-cheats-unlimited-g
21 Juni 2017 - 11:24:08 WIB

I think the admin of this web site is really working hard in support of his site,
for the reason that here every stuff is quality based information.
video conferencing
21 Juni 2017 - 01:23:48 WIB

Greetings! This is my first visit to your blog! We are a group of volunteers and starting a new project in a community in the same niche.
Your blog provided us beneficial information to work on. You have done
a outstanding job!
Luxura sheds
20 Juni 2017 - 20:53:10 WIB

Fiber also plays a critical role in keeping digestion health.
This method is most efficient with little screens where you can cover a large portion of the screen. A variation can be utilized with a computer system screen.
garage door sales and service
20 Juni 2017 - 17:28:13 WIB

If you wish for to increase your know-how simply keep visiting this web site and be updated with the newest news update posted here.
ideal writing additionally
20 Juni 2017 - 05:22:18 WIB

It is appropriate time to make some plans for the future and
it is time to be happy. I have read this post and if I could I want to suggest you few interesting things or suggestions.
Maybe you can write next articles referring to this article.
I desire to read more things about it!
nose hair growing
20 Juni 2017 - 05:18:54 WIB

Finally, the TRYM II isn't waterproof.
Board of Directors Italy
20 Juni 2017 - 04:54:44 WIB

The Inexperienced occasion establishes itself in Italy.
titussmgys.pages10.com
20 Juni 2017 - 02:55:39 WIB

On the other hand, some prefer the standard ones with cords.
<< First | < Prev | 1 | 2 | Next > | Last >>
Nama :
Website :
Komentar
 
 (Masukkan 6 kode diatas)