megabungkan 2 tabel dan tampil sesuai dengan session login

bagaimana cara megabungkan 2 tabel dan tampil sesuai dengan session login ?

kasus saya, saya mau ambil data no_rakening dari tabel 2 itu ke dalam tabel 1.

id tabel 1 ( id_pelanggan  id_pemiik )

id tabel 2 ( id_pemilik )

id yang sama dari dua tabel itu id_pemilik

tabel 1

<?php
              include("fungsi_koneksi.php");
              $id=$_SESSION['id'];
              $koneksi = koneksi_db();
              $sql = "select * from pesanan where nohp_pelanggan like '%".$id."%' order by nohp_pelanggan asc;";
              $aksi= mysql_query($sql,$koneksi);
?>

            <div class="box-body">
              <table id="example1" class="table table-bordered table-striped" style="font-size:12px;">
                <thead>
              <tr>
              <th ><b>No</th>
              <th><b>Nama Pemilik</th>
              <th><b>Kategori</th>
              <th><b>Type</th>
              <th><b>Jumlah Kamar</th>
              <th><b>Luas Kontrakan</th>
              <th><b>Alamat Kontrakan</th>
              <th><b>Harga Perbulan</th>
              <th><b>Lama Ngontrak</th>
              <th><b>Total Bayar</th>
              <th><b>No Rakening</th> <!-- masuk dalam sini -->
              <th><b>Status</th>
              <th><b>Boking</th>

        </tr>
                </thead>
                <tbody>

              <?php
              $no =1;
              while ($data = mysql_fetch_array($aksi)):?>
              <tr>
              <td width="20" align="center">
               <?php echo $no; ?>
              </td>
                <td align="center" ><font size="1"><?php echo $data['nama_pemilik'];?></td>
                <td align="center" ><font size="1"><?php echo $data['kategori'];?></td>
                <td align="center" ><font size="1"><?php echo $data['type'];?></td>
                <td align="center" ><font size="1"><?php echo $data['jumlah_kamar'];?></td>
                <td align="center" ><font size="1"><?php echo $data['luas'];?></td>
                <td align="center" ><font size="1"><?php echo $data['alamat_kontrakan'];?></td>
                <td align="center" ><font size="1"><?php echo "Rp. ".number_format($data['harga_bulan'])." ,-";?></td>
                <td align="center" ><font size="1"><?php echo $data['bulan'];?></td>
                <td align="center" ><font size="1"><?php echo "Rp. ".number_format($data['total_bayar'])." ,-";?></td>
                <td width="100" align="center">

                <?php
                            $status = $data['status'];

                            if ($status=='pending'){
                              echo "<span class='badge badge-pill badge-warning'> $status </span>";
                            }else{
                              echo "<span class='badge badge-pill badge-success'> $status </span>";
                            }
                             ;?>
                </td>
                  <td width="150" align="center"><a  name="edit" href="data_boking.php?id_pesan=<?php echo $data['id_pesan'];?>"><i class="fa fa-edit " style="font-size:20px;color:blue;"></i> </a></td>


              </tr>
              <?php
              $no++;
              endwhile;
              ?>
                </tbody>
              </table>

tabel 2

<?php
		include 'koneksisimpan.php';
		?>

		<table border="1">
			<tr>
				<th>No</th>
				<th>nama pemilik</th>
				<th>nohp pemilik</th>
				<th>alamat</th>
				<th>no rakening</th>

			</tr>
			<?php
			$no = 1;

			$sql = mysqli_query($koneksi,"select * tb_pemilik");
			while($data = mysqli_fetch_array($sql)){
			?>
			<tr>
				<td><?php echo $no++; ?></td>
				<td><?php echo $data['nama_pemililik']; ?></td>
				<td><?php echo $data['nohp_pemilik']; ?></td>
				<td><?php echo $data['alamat']; ?></td>
				<td><?php echo $data['no_rakening']; ?></td>
			</tr>
			<?php
			}
			?>
avatar juanda001
@juanda001

5 Kontribusi 4 Poin

Diperbarui 3 tahun yang lalu

Belum ada Jawaban. Jadi yang pertama Jawaban

Login untuk ikut Jawaban