-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.php
More file actions
70 lines (57 loc) · 1.47 KB
/
Copy pathtest.php
File metadata and controls
70 lines (57 loc) · 1.47 KB
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
69
70
<form method="post">
<input type="text" name="acno"/>
<br />
<br />
<br />
<input type="text" name="tacno"/>
<br />
<br />
<br />
<input type="text" name="bal"/>
<br />
<br />
<br />
<input type="submit" name="send" value="tRANSFER" />
</form>
<?php
if(isset($_POST['send']))
{
$acno=$_POST['acno'];
$tacno=$_POST['tacno'];
$bal=$_POST['bal'];
$con=mysql_connect("localhost","root","");
if(!$con)
{
die("Not connected".mysql_error());
}
mysql_select_db("project",$con);
$q="select balance from account_details where acc_type='".$acno."'";
$i=mysql_query($q);
if($arr=mysql_fetch_array($i))
{
$balance_user=$arr[0];
if($bal>$balance_user)
{
echo 'Sorry You have not sufficient ammount to transfer.';
break;
}
$check ="select acc_type from account_details";
$a=mysql_query($check);
$balance_user_update=$balance_user-$bal;
echo $balance_user_update;
$update_user_balance ="update account_details set balance='".$balance_user_update."' where acc_type='".$acno."'";
$j=mysql_query($update_user_balance);
$q="select balance from account_details where acc_type='".$tacno."'";
$i=mysql_query($q);
if($arr=mysql_fetch_array($i))
{
$balance_user=$arr[0];
$balance_user_update=$balance_user+$bal;
echo $balance_user_update;
$update_user_balance ="update account_details set balance='".$balance_user_update."' where acc_type='".$tacno."'";
$j=mysql_query($update_user_balance);
}
}
header("location:test.php");
}
?>