-
Notifications
You must be signed in to change notification settings - Fork 0
/
registor_helper.php
51 lines (38 loc) · 1.27 KB
/
registor_helper.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
<?php
require('config/connection.php');
$mobile=$_POST['mobile'];
$pass=$_POST['pass'];
$name=$_POST['name'];
$house=$_POST['house'];
$address=$_POST['address'];
$last_id;
// echo $mobile.$pass.$name.$house.$address;
$account=rand(100000000,999999999);
$sql="INSERT into login (mobile_no,password,role) VALUES($mobile,$pass,3)";
if(!mysqli_query($conn,$sql)){
echo mysqli_error($conn);
}else {
$last_id = mysqli_insert_id($conn);
$sql2="INSERT into citizen (id,Full_name,houseNo,address,account_no) VALUES($last_id,'$name',$house,'$address',$account)";
if(!mysqli_query($conn,$sql2)){
echo mysqli_error($conn);
}else{
if(isset($_POST['refer']) && $_POST['refer']!='' ){
$by=$_POST['refer'];
$sql="INSERT into refer (refer_by,refer_to) VALUES($by,$last_id)";
if(!mysqli_query($conn,$sql)){
echo mysqli_error($conn);
}else{
$sql="INSERT into transection (amount,mode,narration,account_no) VALUES(3,'CREDIT','For Refer',$by)";
if(!mysqli_query($conn,$sql)){
echo mysqli_error($conn);
}else{
echo 1;
}
}
}else{
echo 1;
}
}
}
?>