Project Report of Electricity Billing System
Page - 73
fwrite($fp,$csvdata);
}
fclose($fp);
header('Content-type: application/csv');
header("Content-Disposition: inline; filename=".$fname);
readfile($fname);
}
?>
Project Report of Electricity Billing System
Page - 74
Coding for Category.php
include_once("../includes/db_connect.php");
include_once("../includes/functions.php");
if($_REQUEST[act]=="save_category")
{
save_category();
exit;
}
if($_REQUEST[act]=="delete_category")
{
delete_category();
exit;
}
if($_REQUEST[act]=="update_category_status")
Project Report of Electricity Billing System
Page - 75
{
update_category_status();
exit;
}
###Code for save category#####
function save_category()
{
$R=$_REQUEST;
if($R[category_id])
{
$statement = "UPDATE `category` SET";
$cond = "WHERE `category_id` = '$R[category_id]'";
$msg = "Data Updated Successfully.";
}
else
Project Report of Electricity Billing System
Page - 76
{
$statement = "INSERT INTO `category` SET";
$cond = "";
$msg="Data saved successfully.";
}
$SQL= $statement."
`category_name` = '$R[category_name]',
`category_description` = '$R[category_description]'".
$cond;
$rs = mysql_query($SQL) or die(mysql_error());
header("Location:../category-report.php?msg=$msg");
}
#########Function for delete category##########3
function delete_category()
{
/////////Delete the record//////////
|