|
|
|
มีปัญหาตอน insert แล้วแสดงค่าในส่วนของ revenueother มันแอดค่าเข้าแต่มันไม่แสดงผลออกมาอะครับต้องกดปุ่มแอดอีกครั้งถึงจะมีค่าแล้วก้ถ้ากด f5 จะเพิ่มค่าลงเรื่อยๆอะครับ |
|
|
|
|
|
|
|
Code (PHP)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, shrink-to-fit=no, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<title>ชำระเงิน</title>
<!-- Bootstrap Core CSS -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<!-- Custom CSS -->
<link href="css/simple-sidebar.css" rel="stylesheet">
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<div id="wrapper">
<!-- Sidebar -->
<div id="sidebar-wrapper">
<ul class="sidebar-nav">
<li class="sidebar-brand">
<a href="main_user.php">
หน้าหลัก
</a>
</li>
<li>
<a href="userpage_payment.php">ค่าใช้จ่าย</a>
</li>
<li>
<a href="userpage_give.php">บริจาค</a>
</li>
<li>
<a href="userpage_problem.php">แจ้งปัญหา</a>
</li>
<li>
<a href="logout.php">ออกจากระบบ</a>
</li>
</ul>
</div>
<!-- Page Content -->
<div id="page-content-wrapper">
<div class="container-fluid">
<div class="row">
<div class="col-lg-12">
<center>
<h3>รายรับ</h3>
<div id="container" style="min-width: 10px; height: 10px; margin: 0 auto"></div>
<form name="form1" method="post" action="revicelist.php">
<table class="table">
<tr>
<th style="color:#000000;background:#E6E6FA" width="100">วัน</th>
<th style="color:#000000;background:#E6E6FA" width="100">ประเภทรายรับ</th>
<th style="color:#000000;background:#E6E6FA" width="100">จำนวนเงิน</th>
<th style="color:#000000;background:#E6E6FA" width="100">จ่ายโดย</th>
<?php
$con = mysql_connect("localhost","root","");
if (!$con) die('Could not connect: ' . mysql_error());
mysql_select_db("mydatabase2", $con);
mysql_query("set NAMES utf8");
$result = mysql_query("SELECT * FROM donate order by namepro");
while($row = mysql_fetch_array($result)) {
echo "<tr>";
echo "<td >".$row['datepay'] ."</td>";
echo "<td >".$row['namepro'] . "</td>";
echo "<td >".$row['money'] . "</td>";
echo "<td >".$row['name'] . "</td>";
echo "</tr>";
}
?>
<?php
$con = mysql_connect("localhost","root","");
if (!$con) die('Could not connect: ' . mysql_error());
mysql_select_db("mydatabase2", $con);
mysql_query("set NAMES utf8");
$result2 = mysql_query("SELECT * FROM type order by type");
while($row = mysql_fetch_array($result2)) {
echo "<tr>";
echo "<td >".$row['datepay'] ."</td>";
echo "<td >".$row['type'] . "</td>";
echo "<td >".$row['money'] . "</td>";
echo "<td >".$row['name'] . "</td>";
echo "</tr>";
}
?>
<?php
$con = mysql_connect("localhost","root","");
if (!$con) die('Could not connect: ' . mysql_error());
mysql_select_db("mydatabase2", $con);
mysql_query("set NAMES utf8");
$reven = mysql_query("SELECT * FROM revenueother order by typeother");
while($row = mysql_fetch_array($reven)) {
echo "<tr>";
echo "<td >".$row['dateother'] ."</td>";
echo "<td >".$row['typeother'] . "</td>";
echo "<td >".$row['moneyother'] . "</td>";
echo "<td >".$row['paybyother'] . "</td>";
echo "</tr>";
}
?>
<tr>
<td><input name="dateo" type="date" id="date" /></td>
<td><input name="typeo" type="text" id="tx1" /></td>
<td><input name="moneyo" type="text" id="tx2" /></td>
<td><input name="paybyo" type="text" id="tx3" /></td>
</tr>
<tr>
<td><input name="submit" type="submit" id="button" value="บันทึก"></td>
</tr>
<?php
$con = mysql_connect("localhost","root","");
if (!$con) die('Could not connect: ' . mysql_error());
mysql_select_db("mydatabase2", $con);
mysql_query("set NAMES utf8");
if($_POST['typeo']!=""||$_POST['moneyo']!=""||$_POST['paybyo']!=""){
$sql_statement = "INSERT INTO revenueother( dateother, typeother, moneyother, paybyother) VALUES ('" .$_POST["dateo"] . "', '" .$_POST["typeo"] . "', '" .$_POST["moneyo"] . "', '" .$_POST["paybyo"] . "')";
$inser = mysql_query($sql_statement);
}
?>
</table>
</center>
</div>
</div>
</div>
</div>
<!-- /#page-content-wrapper -->
</div>
<!-- /#wrapper -->
<!-- jQuery -->
<script src="js/jquery.js"></script>
<!-- Bootstrap Core JavaScript -->
<script src="js/bootstrap.min.js"></script>
<!-- Menu Toggle Script -->
<script>
$("#menu-toggle").click(function(e) {
e.preventDefault();
$("#wrapper").toggleClass("toggled");
});
</script>
</body>
</html>
Tag : PHP
|
|
|
|
|
|
Date :
2016-12-12 22:17:21 |
By :
magichan |
View :
663 |
Reply :
1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ถ้าคุณทำการบันทึกในไฟล์เดิม ลองเพิ่มคำสั่ง refresh page (javascript) หลังจากบันทึกเสร็จดูครับ
สร้างเงื่อนไขหลังการ insert ถ้าการ insert เป็น true ก็ refresh page (javascript) กันไป...
|
|
|
|
|
Date :
2016-12-13 09:45:27 |
By :
apisitp |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 01
|