-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwaltest.php
More file actions
33 lines (29 loc) · 820 Bytes
/
Copy pathwaltest.php
File metadata and controls
33 lines (29 loc) · 820 Bytes
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
<?php
include "newcon.php";
if (isset($_POST["submit"])){
$username=$_SESSION['username'];
$amount=$_POST['number'];
$conn = new mysqli('localhost','root','','user-verification');
if($conn->connect_error){
die('connection failed : '.$conn->connect_error);
}
$sql = "SELECT cash FROM users WHERE username='$username'";
$result = mysqli_query($conn, $sql);
$cash_table;
if($result){
foreach($result as $row){
$cash_table=$row['cash'];
}
$total=$amount + $cash_table;
$sql="UPDATE users SET cash='$total' WHERE username='$username'";
$query=mysqli_query($conn,$sql);
if($query){
header("location: wallet.php?resultsaved=sucess");
}
else{
echo "$username";
}
$conn->close();
}
}
?>