Advertisement
kura2yamato

cetak 1-1

Apr 24th, 2017
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.     $cek="select * from outlet_sofie where wilayah='Jakarta' ";
  3.     $hasil=mysql_query($cek);
  4. $cetak=array();
  5.     while ($data=mysql_fetch_array($hasil)){
  6.         if ($data['outlet']=="Modern Outlet Lokal") {
  7.             //  echo "<h3>$data[outlet]</h3>";
  8.             $cetak[$data['outlet']][]=("
  9.                 <div class='outlet'>
  10.                     <h3>$data[nama_outlet]</h3>
  11.                     Alamat : $data[alamat_outlet]<br>
  12.                     No Telp : $data[telp_outlet]
  13.                 </div>
  14.             ");
  15.         }
  16.         else if ($data['outlet']=="Baby Shop") {
  17.         //  echo "<h3>$data[outlet]</h3>";
  18.             $cetak[$data['outlet']][]= ("
  19.                     <div class='outlet'>
  20.                         <h3>$data[nama_outlet]</h3>
  21.                         Alamat : $data[alamat_outlet]<br>
  22.                         No Telp : $data[telp_outlet]
  23.                     </div>
  24.                 ");
  25.         }
  26.         else if ($data['outlet']=="Apotik") {
  27.         //  echo "<h3>$data[outlet]</h3>";
  28.             $cetak[$data['outlet']][]= ("
  29.                 <div class='outlet'>
  30.                     <h3>$data[nama_outlet]</h3>
  31.                     Alamat : $data[alamat_outlet]<br>
  32.                     No Telp : $data[telp_outlet]
  33.                 </div>
  34.             ");
  35.         }
  36.         else if ($data['outlet']=="Rumah Sakit/ RSIA/ RSB") {
  37.         //  echo "<h3>$data[outlet]</h3>";
  38.             $cetak[$data['outlet']][]=("
  39.                 <div class='outlet'>
  40.                     <h3>$data[nama_outlet]</h3>
  41.                     Alamat : $data[alamat_outlet]<br>
  42.                     No Telp : $data[telp_outlet]
  43.                 </div>
  44.             ");
  45.         }
  46.     }
  47. foreach($cetak as $name=>$values){
  48. echo "<h3>{$name}</h3>".implode("\n",$values);
  49. }
  50. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement