-
Notifications
You must be signed in to change notification settings - Fork 4
/
dstor.php
68 lines (54 loc) · 1.66 KB
/
dstor.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<?php
include'conf.inc';
// Inialize session
session_start();
// Check, if username session is NOT set then this page will jump to login page
if (!isset($_SESSION['user'])) {
header('Location: timeout.php');
}
?>
<center>
<?php
include_once 'conf.inc';
$invp=$_SESSION['user'];
$inv="select * from users where username='$invp'";
$ansinv=mysql_query($inv);
while($row=mysql_fetch_array($ansinv))
{
$invoicepre = $row['ccode'];
}
//echo " session counter is " . $_SESSION['counter']; //echoes current value of counter
$ino="select id from birth_reg";
$ansin=mysql_query($ino);
while($row=mysql_fetch_array($ansin))
{
$no = $row['id'];
}
$sql2 ="SELECT id FROM death_reg WHERE id > '$id' ORDER by id DESC LIMIT 1";
$resultn = mysql_query($sql2);
$nextrows = mysql_num_rows($resultn);
while ($nextrow = mysql_fetch_array($resultn)) {
$next=$nextrow['id']+1;
}
$d=date('Y');
$m=date('M');
$no=$ino;
$a=$invoicepre .'/'.$d.'/'.$m.'/'.$next;
$sql="INSERT INTO death_reg (Registerno, districit, zone, name, sex, dod, pod, father, mother, p_address, a_t_birth, remark, dor)
VALUES('$a','$_POST[dist]','$_POST[zone]','$_POST[name]','$_POST[sex]','$_POST[bday]','$_POST[placedeath]','$_POST[father]','$_POST[mother]','$_POST[paddress]','$_POST[aaddress]','$_POST[remarks]',NOW())";
echo $id;
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
echo"<script language='javascript'>
alert('Death Information Registered Sucessfully' )
window.location = 'deathentry.php';
</script>";
//echo $a;
//
//echo "<b>Invoice Created Sucessfully........! </b><br><br>";?>
<?php //echo"<a href='makebill.php'>Back</a>";
mysql_close($con)
?>
</center>