-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathpoints.php
More file actions
33 lines (24 loc) · 866 Bytes
/
points.php
File metadata and controls
33 lines (24 loc) · 866 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 "connection.php";
if(isset($_POST['id']))
{
if(isset($_POST['points'])) {
$sql = "UPDATE `users` SET `points` = :points
WHERE id = '".$_POST["id"]."' ";
$statement = $conn->prepare($sql);
$statement->bindValue(':points', $_POST['points']);
$updated = $statement->execute();
if($updated){
$sth = $conn->prepare("SELECT * FROM users WHERE id = '".$_POST["id"]."' " );
$sth->execute();
$result2 = $sth->fetch(PDO::FETCH_ASSOC);
echo json_encode($result2);
}
}else {
$sth = $conn->prepare("SELECT * FROM users WHERE id = '".$_POST["id"]."' " );
$sth->execute();
$result2 = $sth->fetch(PDO::FETCH_ASSOC);
echo json_encode($result2);
}
}
?>