Demo - Download
liberoram-bal
Inded.php

<?php
error_reporting(0);
include('connection.php'); ?>
.mytab td, th { border: 1px solid #0da3e2; padding: 5px !important; text-align: center !important; } .mytab { width: 100%; } .red{ color:red;} h2{ text-align:center; }

Libero Ram

$cridit =mysql_query("select sum(Credit) AS cri from test where STR_TO_DATE(TransDate,'%Y-%m-%d')while($rlt = mysql_fetch_array($sql)){ $cr = $rlt['Credit']; $dit= $rlt['Debit']; $tbal.$i = ($bal.$i+$cr -$dit - 1); ?> <table class="mytab">
<tr style="font-weight:bold">
<td>S.no</td>
<td>date</td>
<td>Credit</td>
<td>Debit</td>
<td>Balance</td></tr>
<?php
$sql = mysql_query("select * from test");
$i =1;
$x =1;

//<!--------- previous_balance using search by date ----->

$cridit =mysql_query("select sum(Credit) AS cri from test where STR_TO_DATE(TransDate,'%Y-%m-%d') < '2014-02-21'");
$cridits= mysql_fetch_assoc($cridit);
$previous_balance22 = $cridits['cri'] ;

$Debit =mysql_query("select sum(Debit) AS dit from test where STR_TO_DATE(TransDate,'%Y-%m-%d') < '2014-02-21'");
$Debits= mysql_fetch_assoc($Debit);
$previous_balance1 = $Debits['dit'] ;
echo $previous_balance1 =$previous_balance22 - $previous_balance1;

//<!--------- previous_balance ----->

while($rlt = mysql_fetch_array($sql)){
$cr = $rlt['Credit'];
$dit= $rlt['Debit'];
$tbal.$i = ($bal.$i+$cr -$dit - 1);
?>

<tr><td><?php echo $x ?></td>
<td><?php echo $rlt['TransDate']; ?></td>
<td><?php echo $cr ?></td>
<td><?php echo $dit ?></td>
<td><?php echo $tbal.$i;
?></td>
</tr>
<?php $i++; $x++; }

?> </table>
Connection.php <?php $dbhost = "localhost"; $dbusername = "root"; $dbpassword = ""; $dbname = "new-trade"; $item_per_page = 1; $connection = mysql_connect($dbhost, $dbusername, $dbpassword) or die('Could not connect'); $db = mysql_select_db($dbname); ?> Demo - Download
Advertisements