Project Report of Electricity Billing System
Page - 70
{
$statement = "INSERT INTO `book` SET";
$cond = "";
$msg="Data saved successfully.";
}
$SQL= $statement."
`book_user_id` = '$_SESSION[user_details][user_id]',
`book_date` = now(),
`book_room_id` = '$R[book_room_id]',
`book_from_date` = '$R[book_from_date]',
`book_to_date` = '$R[book_to_date]',
`book_no_rooms` = '$R[book_no_rooms]',
`book_no_persons` = '$R[book_no_persons]',
`book_no_childs` = '$R[book_no_childs]',
`book_name` = '$R[book_name]',
`book_mobile` = '$R[book_mobile]',
Project Report of Electricity Billing System
Page - 71
`book_email` = '$R[book_email]',
`book_total_amount` = '$totalAmount',
`book_status` = '0'".
$cond;
$rs = mysql_query($SQL) or die(mysql_error());
if($R[book_id] == "") {
$book_id = mysql_insert_id();
}
header("Location:../make_payment.php?book_id=".$book_id);
}
#########Function for delete book##########3
function delete_book()
{
/////////Delete the record//////////
$SQL="DELETE FROM book WHERE book_id = $_REQUEST[book_id]";
mysql_query($SQL) or die(mysql_error());
Project Report of Electricity Billing System
Page - 72
header("Location:../book-report.php?msg=Deleted Successfully.");
}
##############Function for reporting ##################3
function get_report()
{
$fname = 'myCSV.csv';
$fp = fopen($fname,'w');
$column_name =
'"ID","book_name","book_add1","book_add2","book_state","book_email","book_city","book_mobile","
book_gender","book_dob","book_nl_id","book_image"'."\n\r";
fwrite($fp,$column_name);
$SQL="SELECT * FROM book,city WHERE book_city = city_id";
$rs=mysql_query($SQL);
while($data=mysql_fetch_assoc($rs))
{
$csvdata=implode(",",$data)."\n\r";
|