Table 2 ka ka thiyene records 1 csv ekata daganna one
meke Header and datarecord kiyala table 2 k thiyanawa...
header table 1st row eke data print wela ita adala data datarecord table eken aran print karanna one ..oya widyta loop ekak thama yanne
mage wadenam wenawa awula thiyenne
Header - columns 12
datarecord - columns 24 thiyenawa
header table eka row data double print wenawa
attached image balalana...
code eka yata athi [mama php expert newe net eken thama oya tikath hoya gathe ] pLZ help me

<?php
require_once(dirname(__FILE__)."/classes/db-connection.php");
$obj = new dbconnection();
$con = $obj->getcon();
header('Content-type: text/csv; charset=utf-8');
header("Content-Disposition: attachment; filename=Data.csv");
$output =fopen("php://output" ,"w");
$output1 =fopen("php://output" ,"w");
$SQL = "SELECT * from headerrecordii ";
$exportData = mysql_query ($SQL) or die ("Sql error : " . mysql_error( ) );
while( $row = mysql_fetch_array($exportData) ) {
$banckcode=$row["BranchCode"];
fputcsv($output, $row);
$SQL1 = "SELECT * from datarecords where banckcode='$banckcode' ";
$exportData1 = mysql_query ($SQL1) or die ("Sql error : " . mysql_error( ) );
while( $row1 = mysql_fetch_assoc($exportData1) ) {
fputcsv($output1, $row1);
}
}
fclose($output);
fclose($output1);
?>
meke Header and datarecord kiyala table 2 k thiyanawa...
header table 1st row eke data print wela ita adala data datarecord table eken aran print karanna one ..oya widyta loop ekak thama yanne
mage wadenam wenawa awula thiyenne
Header - columns 12
datarecord - columns 24 thiyenawa
header table eka row data double print wenawa
attached image balalana...
code eka yata athi [mama php expert newe net eken thama oya tikath hoya gathe ] pLZ help me
<?php
require_once(dirname(__FILE__)."/classes/db-connection.php");
$obj = new dbconnection();
$con = $obj->getcon();
header('Content-type: text/csv; charset=utf-8');
header("Content-Disposition: attachment; filename=Data.csv");
$output =fopen("php://output" ,"w");
$output1 =fopen("php://output" ,"w");
$SQL = "SELECT * from headerrecordii ";
$exportData = mysql_query ($SQL) or die ("Sql error : " . mysql_error( ) );
while( $row = mysql_fetch_array($exportData) ) {
$banckcode=$row["BranchCode"];
fputcsv($output, $row);
$SQL1 = "SELECT * from datarecords where banckcode='$banckcode' ";
$exportData1 = mysql_query ($SQL1) or die ("Sql error : " . mysql_error( ) );
while( $row1 = mysql_fetch_assoc($exportData1) ) {
fputcsv($output1, $row1);
}
}
fclose($output);
fclose($output1);
?>
Last edited: