这是ajax在另一个页面上调用的过滤器页面。我正在过滤有关日期的数据,该数据在localhost服务器上运行良好,但在实时服务器上却没有运行。
这是我的filterCustomerTransaction.php
<?php
include 'connect.php';
if(isset($_POST["from_date"],$_POST["to_date"])){
echo '<div class="col-sm-6" style="background-color: white;">
<div class="panel-body"><h4><b>Customer Transaction</b></h4>';
$output = "";
$query = "SELECT * FROM `payments` WHERE date BETWEEN '" . $_POST["from_date"] . "' AND '" . $_POST["to_date"] . "'";
$result = mysqli_query($con, $query);
$output .= '<table class="table table-bordered" style="width:100%; border:2px solid red;">
<thead >
<tr style="background-color:red;">
<th width="5%">S/L No</th>
<th width ="40%">Customer Name</th>
<th width="40%">Date</th>
<th width="30%">Receive For</th>
<th width="43%">Bill Amount</th>
<th width="40%">Cash</th>
<th width="42%">Discount</th>
<th width="70%">Adv Adjustment</th>
<th width="45%">Net Amount</th>
<th width="45%"> Cheque</th>
<th width="45%"> Bank Transfer</th>
<th width="45%">Payment Gateway </th>
<th width="50%"> Card Swipe</th>
</tr>
</thead>';
while ($row = mysqli_fetch_array($result)) {
$output .= '<tbody>
<tr>
<td>' . $row["customerId"] . '</td>
<td>' . $row["customerName"] . '</td>
<td>' . $row["date"] . '</td>
<td>' . $row["payingForType"] . '</td>
<td>' . $row["billAmount"] . '</td>
<td>' . $row["cash"] . '</td>
<td>' .$row["discount"]. '</td>
<td>' .$row["advanceAdj"]. '</td>
<td>' .$row["netAmount"]. '</td>
<td>' .$row["cheque"]. '</td>
<td>' .$row["bankTransfer"]. '</td>
<td>' .$row["paymentGateway"]. '</td>
<td>' .$row["cardSwipe"]. '</td>
</tr>';
}
echo'</tbody>';
echo'<tfoot>';
echo'<tr>';
echo'<th>';
echo'</th></tr>
</tfoot>';
} else {
$output .= '<tr><td colspan="5">No Data Found</td></tr>';
}
$output .= '</table>';
echo $output;
?>
这是我称为该过滤器页面的主页
这是我的密码
<?php
include 'connect.php';
?>
<h2>All Transaction</h2>
<ul class="nav nav-pills">
<!--<li class="active"><a data-toggle="pill" href="#home">Home</a></li>-->
<li class="active"><a data-toggle="pill" href="#menu1">Customer Transaction</a></li>
<li ><a data-toggle="pill" href="#menu2" >EOD Summery</a></li>
<li><a data-toggle="pill" href="#menu3">Cash Payment</a></li>
<li><a data-toggle="pill" href="#menu4">Cash in Hand</a></li>
<li><a data-toggle="pill" href="#menu5">Point Calculation</a></li>
</ul>
<!--CUSTOMER TRABSACTION-->
<div class="tab-content">
<div id="menu1" class="tab-pane fade in active">
<div class="panel panel-warning col-sm-12" style="width:100%;border: none;">
<div class="col-md-3">
<input type="text" name="from_date" id="from_date" class="form-control" placeholder="From Date" />
</div>
<div class="col-md-3">
<input type="text" name="to_date" id="to_date" class="form-control" placeholder="To Date" />
</div>
<div class="col-md-5">
<input type="button" name="filter" id="filter1" value="Filter" class="btn btn-info" />
</div>
<div style="clear:both">
<input type="button" id="btnExport" class="btn-danger" style="margin-bottom: 1%;float: right;" value="Export Excel" />
</div>
</div>
<div id="order_table1">
<table class="table table-bordered" style="width:100%;" id="tblCustomers" >
<tr style="background-color:red; color:white; ">
<th>S/L No</th>
<th>customer Name</th>
<th>Date</th>
<th>Receive For</th>
<th>Bill Amount</th>
<th>Discount</th>
<th>Advance Adjustment</th>
<th>Net Amount</th>
<th>Cash</th>
<th>Cheque</th>
<th>Bank Transfer</th>
<th>Payment Gateway</th>
<th>Card swipe</th>
<th></th>
</tr>
<?php
$sql = "SELECT * FROM `payments` ORDER BY customerId DESC ";
$result = mysqli_query($con,$sql);
while ($row = $result->fetch_assoc()) {
?>
<tr id="row<?php echo $row['customerId']; ?>">
<td id="customerId<?php echo $row['customerId']; ?>"><?php echo $row['customerId']; ?></td>
<td id="customerName<?php echo $row['customerId']; ?>"><?php echo $row['customerName']; ?></td>
<td id="date<?php echo $row['customerId']; ?>"><?php echo $row['date']; ?></td>
<td id="payingForType<?php echo $row['customerId']; ?>"><?php echo $row['payingForType']; ?></td>
<td id="billAmount<?php echo $row['customerId']; ?>"><?php echo $row['billAmount']; ?></td>
<td id="discount<?php echo $row['customerId']; ?>"><?php echo $row['discount']; ?></td>
<td id="advanceAdj<?php echo $row['customerId']; ?>"><?php echo $row['advanceAdj']; ?></td>
<td id="netAmount<?php echo $row['customerId']; ?>"><?php echo $row['netAmount']; ?></td>
<td id="cash<?php echo $row['customerId']; ?>"><?php echo $row['cash']; ?></td>
<td id="cheque<?php echo $row['customerId']; ?>"><?php echo $row['cheque']; ?></td>
<td id="bankTransfer<?php echo $row['customerId']; ?>"><?php echo $row['bankTransfer']; ?></td>
<td id="paymentGateway<?php echo $row['customerId']; ?>"><?php echo $row['paymentGateway']; ?></td>
<td id="cardSwipe<?php echo $row['customerId']; ?>"><?php echo $row['cardSwipe']; ?></td>
<td>
<input type='button' class="edit_button" Style="background-color:red; color:white;" id="edit_button<?php echo $row['customerId']; ?>" value="edit" onClick="edit_row('<?php echo $row['customerId']; ?>');">
<input type='button' class="save_button" Style="background-color:red; color:white;" id="save_button<?php echo $row['customerId']; ?>" value="save" onClick="save_row('<?php echo $row['customerId']; ?>');">
</td>
</tr>
<?php
}
?>
</table>
</div>
</div>
这些是我称为过滤器页面的JavaScript
<script>
$(document).ready(function () {
$.datepicker.setDefaults({
dateFormat: 'yy-mm-dd'
});
$(function () {
$("#from_date").datepicker();
$("#to_date").datepicker();
});
$('#filter1').click(function () {
var from_date = $('#from_date').val();
var to_date = $('#to_date').val();
if (from_date != '' && to_date != '')
{
$.ajax({
url: "filterCustomerTransaction.php",
method: "POST",
data: {from_date: from_date, to_date: to_date},
success: function (data)
{
$('#order_table1').html(data);
}
});
} else
{
}
});
});
</script>