herie89Avatar border
TS
herie89
[ASK] Penjumlahan toal dari tabel stock ( Dreamweaver )
Permisi gan mohon maaf kalo pertanyaan repost, ane ubek2 di thred dalam 1 minggu ini tapi gak ketemu2 pertanyaan yg model begini, ane posting di postingan orang tapi gak kunjung dijawab, mudah2an disini ada yg sudi menjawab pertanyaan ane yg seminggu ini gak kunjung kelar, maklum gan ane newbi yg lagi belajar membuat website menggunakan Dreamweaver.

Jadi ceritanya ane punya Database : rentalmobil dan tabelnya : merek yg ane mau jumlahkan itu total stock dari tabel merek. ane udah coba pake SUM tapi gak berhasil (Bingung Nulisnya emoticon-Big Grin ). langsung aja ane tampilin script dari dreamweaver nya :

Code:

<?php require_once('Connections/rentalmobil.php'); ?>
<?php
if (!isset($_SESSION)) {
session_start();
}
$MM_authorizedUsers = "admin";
$MM_donotCheckaccess = "false";

// *** Restrict Access To Page: Grant or deny access to this page
function isAuthorized($strUsers, $strGroups, $UserName, $UserGroup) {
// For security, start by assuming the visitor is NOT authorized.
$isValid = False;

// When a visitor has logged into this site, the Session variable MM_Username set equal to their username.
// Therefore, we know that a user is NOT logged in if that Session variable is blank.
if (!empty($UserName)) {
// Besides being logged in, you may restrict access to only certain users based on an ID established when they login.
// Parse the strings into arrays.
$arrUsers = Explode(",", $strUsers);
$arrGroups = Explode(",", $strGroups);
if (in_array($UserName, $arrUsers)) {
$isValid = true;
}
// Or, you may restrict access to only certain users based on their username.
if (in_array($UserGroup, $arrGroups)) {
$isValid = true;
}
if (($strUsers == "") && false) {
$isValid = true;
}
}
return $isValid;
}

$MM_restrictGoTo = "home.php";
if (!((isset($_SESSION['MM_Username'])) && (isAuthorized("",$MM_authorizedUsers, $_SESSION['MM_Username'], $_SESSION['MM_UserGroup'])))) {
$MM_qsChar = "?";
$MM_referrer = $_SERVER['PHP_SELF'];
if (strpos($MM_restrictGoTo, "?")) $MM_qsChar = "&";
if (isset($QUERY_STRING) && strlen($QUERY_STRING) > 0)
$MM_referrer .= "?" . $QUERY_STRING;
$MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . "accesscheck=" . urlencode($MM_referrer);
header("Location: ". $MM_restrictGoTo);
exit;
}
?>

<?php
$colname_rsSession = "-1";
if (isset($_SESSION['MM_Username'])) {
$colname_rsSession = (get_magic_quotes_gpc()) ? $_SESSION['MM_Username'] : addslashes($_SESSION['MM_Username']);
}
mysql_select_db($database_rentalmobil, $rentalmobil);
$query_rsSession = sprintf("SELECT * FROM pengguna WHERE email = '%s'", $colname_rsSession);
$rsSession = mysql_query($query_rsSession, $rentalmobil) or die(mysql_error());
$row_rsSession = mysql_fetch_assoc($rsSession);
$totalRows_rsSession = mysql_num_rows($rsSession);

$maxRows_rsMerek = 10;
$pageNum_rsMerek = 0;
if (isset($_GET['pageNum_rsMerek'])) {
$pageNum_rsMerek = $_GET['pageNum_rsMerek'];
}
$startRow_rsMerek = $pageNum_rsMerek * $maxRows_rsMerek;

mysql_select_db($database_rentalmobil, $rentalmobil);
$query_rsMerek = "SELECT * FROM merek";
$query_limit_rsMerek = sprintf("%s LIMIT %d, %d", $query_rsMerek, $startRow_rsMerek, $maxRows_rsMerek);
$rsMerek = mysql_query($query_limit_rsMerek, $rentalmobil) or die(mysql_error());
$row_rsMerek = mysql_fetch_assoc($rsMerek);

if (isset($_GET['totalRows_rsMerek'])) {
$totalRows_rsMerek = $_GET['totalRows_rsMerek'];
} else {
$all_rsMerek = mysql_query($query_rsMerek);
$totalRows_rsMerek = mysql_num_rows($all_rsMerek);
}
$totalPages_rsMerek = ceil($totalRows_rsMerek/$maxRows_rsMerek)-1;

mysql_select_db($database_rentalmobil, $rentalmobil);
$query_rsSUM = "SELECT * FROM merek";
$rsSUM = mysql_query($query_rsSUM, $rentalmobil) or die(mysql_error());
$row_rsSUM = mysql_fetch_assoc($rsSUM);
$totalRows_rsSUM = mysql_num_rows($rsSUM);
?>

<!DOCTYPE html>
<!--[if IE 8]> <html lang="en" class="ie8"> <![endif]-->
<!--[if IE 9]> <html lang="en" class="ie9"> <![endif]-->
<!--[if !IE]><!--> <html lang="en"> <!--<![endif]-->

<!-- BEGIN HEAD -->
<head>
<meta charset="UTF-8" />
<title>HOME</title>
<meta content="width=device-width, initial-scale=1.0" name="viewport" />
<meta content="" name="description" />
<meta content="" name="author" />
<!--[if IE]>
<meta http-equiv="X-UAS E N S O Rpatible" content="IE=edge,chrome=1">
<![endif]-->
<!-- GLOBAL STYLES -->
<link rel="stylesheet" href="assets/plugins/bootstrap/css/bootstrap.css" />
<link rel="stylesheet" href="assets/css/main.css" />
<link rel="stylesheet" href="assets/css/theme.css" />
<link rel="stylesheet" href="assets/css/MoneAdmin.css" />
<link rel="stylesheet" href="assets/plugins/Font-Awesome/css/font-awesome.css" />
<link rel="stylesheet" href="assets/plugins/social-buttons/social-buttons.css" />
<!--END GLOBAL STYLES -->

<!-- PAGE LEVEL STYLES -->
<link href="assets/css/layout2.css" rel="stylesheet" />
<link href="assets/plugins/flot/examples/examples.css" rel="stylesheet" />
<link rel="stylesheet" href="assets/plugins/timeline/timeline.css" />
<!-- END PAGE LEVEL STYLES -->
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
[removed][removed]
[removed][removed]
<![endif]-->
</head>

<!-- END HEAD -->

<!-- BEGIN BODY -->
<body class="padTop53 " >
<!-- MAIN WRAPPER -->
<div id="wrap" >
<!-- HEADER SECTION -->
<?php include "menu.php"; ?>
<!-- MENU left in here -->
<!--END MENU SECTION -->


<div id="body">
<div class="panel-body">
<div class="row">
<div class="col-lg-12">
<div class="panel panel-default">
<div class="panel-heading">
<b>Pilih Merek</b>
</div>
<div class="panel-body">


<div class="table-responsive">
<table class="table table-striped table-bordered table-hover">
<thead>
<tr>
<th width="7%">ICON</th>
<th width="20%">MEREK</th>
<th width="14%">JENIS</th>
<th width="13%">TYPE</th>
<th width="11%">NO POLISI</th>
<th width="12%">STOCK</th>
<th width="13%">HARGA</th>
<?php if($_SESSION['MM_UserGroup']=="admin") { ?>
<th width="10%" align="center" valign="middle"><div align="center"><a href="merek_tambah.php" class="btn btn-social-icon btn-info"><i class="fa fa-plus"></i></a></div></th>
</tr>
<?php } ?>
</thead>
<tbody>
<?php do { ?>
<tr valign="middle">
<td align="center"><img src="upload/<?php echo $row_rsMerek['foto']; ?>" alt="icon" width="64" height="64"/></td>
<td valign="middle"><?php echo $row_rsMerek['nama_produk']; ?></td>
<td valign="middle"><?php echo $row_rsMerek['jenis']; ?></td>
<td valign="middle"><?php echo $row_rsMerek['type']; ?></td>
<td valign="middle"><?php echo $row_rsMerek['nopol']; ?></td>
<td valign="middle"><?php echo $row_rsMerek['stock']; ?></td>
<td valign="middle"><?php echo $row_rsMerek['harga']; ?></td>
<?php if($_SESSION['MM_UserGroup']=="admin") { ?>
<td align="center" valign="bottom">
<a href="merek_edit.php?edit=<?php echo $row_rsMerek['id']; ?>" class="btn btn-social-icon btn-info"><i class="fa fa-pencil"></i></a>
<a href="merek_edit.php?hapus=<?php echo $row_rsMerek['id']; ?>" class="btn btn-social-icon btn-danger"><i class="icon-remove"></i></a> </td>
</tr>
<?php } ?>
<?php } while ($row_rsMerek = mysql_fetch_assoc($rsMerek)); ?>

</tbody>
</table>
</div>
[B]DISINI ANE MAU KASIH TOTAL STOCK NYA[/B]
</div>
</div>
</div>
</div>
</div>
</div>
<!--END PAGE CONTENT -->

<!-- menurigh in here -->
</div>
<!--END MAIN WRAPPER -->

<!-- FOOTER -->
<?php include "footer.php"; ?>
<!--END FOOTER -->


<!-- GLOBAL SCRIPTS -->
[removed][removed]
[removed][removed]
[removed][removed]
<!-- END GLOBAL SCRIPTS -->

<!-- PAGE LEVEL SCRIPTS -->
[removed][removed]
[removed][removed]
[removed][removed]
[removed][removed]
[removed][removed]

<!-- END PAGE LEVEL SCRIPTS -->



</body>

<!-- END BODY -->
</html>
<?php
mysql_free_result($rsSession);

mysql_free_result($rsMerek);

mysql_free_result($rsSUM);
?>



Sekali lagi mohon para master bantuannya. mohon maaf script nya acak2an karena ane bener2 newbi yg baru belajar emoticon-Cendol (S)
0
1.2K
3
GuestAvatar border
Guest
Tulis komentar menarik atau mention replykgpt untuk ngobrol seru
Urutan
Terbaru
Terlama
GuestAvatar border
Guest
Tulis komentar menarik atau mention replykgpt untuk ngobrol seru
Komunitas Pilihan