mohon bantuannya para master :

contoh
saya punya 2 tabel
tb_pondasi dan tb_struktur

tb_pondasi ==> id, nama, harga
isi tb_pondasi = 1, beton bertulang, 500000
2, pancang, 300000
tb_struktur ==> id, nama, harga
isi tb_struktur = 1, beton, 250000
2, baja, 200000

kemudian data dari database diatas saya tampilkan di combobox

gimana cara menjumlahkan harga, jika yang ditampilkan hanya nama saja

terima kasih
Silahkan login untuk menjawab!
mohon bntuanya sdikit para master php
	$id= $_GET['id'];
    
	//get today's date
	$pecah			= explode("-",$tgl_pinjam);
	$next_7_hari	= mktime(0,0,0,$pecah[1],$pecah[0]+7,$pecah[2]);
	$hari_next		= date("Y-m-d", $next_7_hari);

	//write a query to update that the book is returned
	$sql = "UPDATE peminjaman SET tgl_kembali='$hari_next' WHERE id_peminjaman='$id'";

	$result = mysqli_query($connection, $sql);

	if($result){
		echo"<script type='text/javascript'>
			onload =function(){
			alert('Data berhasil diperpanjang!');
		document.location='daftar-peminjaman.php';
		}
		</script>";
	}else{
			echo "<script>alert('Data gagal diperpanjang. Silahkan cek kembali.');</script>";
	}

Lihat semua 1 jawaban

Silahkan login untuk menjawab!
mohon bantuan nya ane mau update dan delete data yang udah ane tampilin
tp ini update nya tanpa ane input tp hanya klik button acc data yang status awal nya pending langsung ke update jadi terima

ini koding tampil

<?php
include "../koneksi.php";

$sql= "SELECT * FROM cuti where nik_a ='" . $_SESSION . "' && status = 'Pending'";

$result=mysql_query($sql);


?>

<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.2/jquery.min.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
</head>
<body>

<div class="container">
<h3>Approve Cuti</h3>
<table class="table table-bordered" action="aprovecuti.php">
<thead>
<tr>
<th>No Slip</th>
<th>NIK</th>
<th>Nama</th>
<th>Tanggal</th>
<th>Alasan</th>
<th>Tgl Cuti</th>
<th>Total Hari</th>
<th>Keterangan</th>
<th>Status</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php
while($rows=mysql_fetch_array($result)){
?>
<tr>
<td><?php echo $rows; ?></td>
<td><?php echo $rows; ?></td>
<td><?php echo $rows; ?></td>
<td><?php echo $rows; ?></td>
<td><?php echo $rows; ?></td>
<td><?php echo $rows; ?></td>
<td><?php echo $rows; ?></td>
<td><?php echo $rows; ?></td>
<td><?php echo $rows; ?></td>
<td><input type="submit" name="acc" onclick="return confirm('ACC permintaan cuti <?php echo $rows; ?> ?');" value="ACC"></a>&nbsp <input type="submit" name="tolak" onclick="return confirm('Tolak permintaan cuti <?php echo $rows; ?> ?');" value="X"></a></td>
</tr>
<?php } ?>
</tbody>
</table>
</div>

</body>
</html>
Silahkan login untuk menjawab!
					<form role="form" method="GET">
						<select name="category">
							<option value="judul">Judul buku</option>
							<option value="pengarang">Pengarang</option>
							<option value="penerbit">Penerbit</option>
							<option value="subyek">Kategori</option>
							<option value="thn_terbit">Tahun terbit</option>
							<option value="no_rak">No Rak</option>
							<option value="isbn">ISBN</option>
						</select>
						<input type="text" placeholder="Masukkan kata kunci" name="keyword">
						<input type="submit" name="search" value="cari" class="btn btn-info">
					</form>
:(:)
Silahkan login untuk menjawab!
saya ingin melakukan pencarian data, disini ada tabel buku
$judul=$_POST;
$id_pengarang=$_POST;
$id_penerbit=$_POST;
$isbn=$_POST;
$no_rak=$_POST;
$id_kategori=$_POST;
$tgl_masuk=date("Y-m-d");

dalam pencarian keynya adalah : judul, id_pengarang, id_penerbit,id_kategori, no_rak
			<div class="well well-lg" id="searchBox">
				<h2 class="text-center">Pencarian Buku</h2>
				<div class="text-center">
					<form role="form" method="GET">
						<select name="category">
							<option value="judul">Judul buku</option>
							<option value="pengarang">Pengarang</option>
							<option value="penerbit">Penerbit</option>
							<option value="subyek">Kategori</option>
							<option value="thn_terbit">Tahun terbit</option>
							<option value="isbn">ISBN</option>
						</select>
						<input type="text" placeholder="Masukkan kata kunci" name="keyword">
						<input type="submit" name="search" value="cari" class="btn btn-info">
					</form>
				</div>
			</div>

			<table class="table table-hover table-bordered">
				<tr>
					<th>No.</th>
					<th>Judul</th>
					<th>Pengarang</th>
					<th>Penerbit</th>
					<th>Kategori</th>
					<th>Tahun terbit</th>
					<th>No Rak</th>
					<th>ISBN</th>
					<th>Action</th>
				</tr>
             <?php
			  $sql="select * from buku,kategori where buku.id_kategori=kategori.id_kategori order by id_buku DESC";
			  $query=mysql_query($sql);
			  $no=1;
			  while($row=mysql_fetch_array($query)){
			  ?>
     <?php
		
	if(isset($_GET['category'])&&isset($_GET['keyword'])){
		$category = $_GET['category'];
		$keyword = $_GET['keyword'];

		//search for data in table buku where category contains keyword
		$sql = "SELECT * FROM buku WHERE $category LIKE '%$keyword%'";
		$result = mysqli_query($connection, $sql); 
		
		$count=mysqli_num_rows($result);	
	}else{
		$sql = "SELECT * FROM buku;";
		$result = mysqli_query($connection, $sql); 
		
		$count=mysqli_num_rows($result);	
	}


	if($count>0){
		$number = 1;	
		
		echo "<p>$count data ditampilkan.<p>";
		
		while($row = mysqli_fetch_assoc($result)) {
			$id = $row["id_buku"];
	        echo "<tr> <td>" . $number. "</td><td> " . 
	        $row["judul"]. "</td><td> " .
	        $row["pengarang"]."</td><td>".
	        $row["penerbit"]."</td><td>".
	        $row["nama_kategori"]."</td><td>".
	        $row["thn_terbit"]."</td><td>".
	        $row["deskripsi_fisik"]."</td><td>".
	        $row["isbn"]."</td><td>".
Silahkan login untuk menjawab!
saya mau nampilin data user setelh login dengan menggunakan session. namun pas saya coba, yang tampil hanya cuma email, nama dan data lain tidak tampil. malahan ada error undefined index nama, bln, gender. tolong sayaaa

proseslogin.php
<?php 
session_start();
	
	require_once("connection.php");
	
	$email = $_POST['email'];
	$password = $_POST['password'];

	$cekuser = mysql_query("SELECT * FROM user WHERE email = '$email'");
	$jumlah = mysql_num_rows($cekuser);
	$hasil = mysql_fetch_array($cekuser);

	
	if($jumlah == 0) {
		echo "<script>alert('Email belum terdaftar!'); window.location = 'index.php'</script>";
	} else {
		if($password > $hasil['password']) {
		echo "<script>alert('Password Salah!'); window.location = 'index.php'</script>";
		} else {
		session_start();
		$_SESSION['email'] = $_POST['email'];
		$_SESSION['password'] = $_POST['password'];
	

		header('location:index.php');
		}
	}
?>


index.php
<?php 

if (session_status() == PHP_SESSION_NONE  || session_id() == '') {
        session_start();
    }

    require_once("connection.php");
    include("lib_function.php");
?>

<--header-->

$email = $_SESSION['email'];
                  include "connection.php";
                  $sql = "select * from user where email='".$email."'";
                  $query = mysql_query($sql);
                  while($data = mysql_fetch_array($query)){
                  
                  echo "Hello, " . $data['nama'] . " <br> " . $data['nname'] . " <br> " . $data['bln'] . " <br> " . $data['gender'] . " (" . $data['email'] . ").";
                  } 
Silahkan login untuk menjawab!