-
Notifications
You must be signed in to change notification settings - Fork 0
/
position.php
64 lines (46 loc) · 1.47 KB
/
position.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
<?php
// session_start();
// $servername = "localhost";
// $username = "root";
// $password = "";
// $dbname="ludo";
include("config.php");
// $body= $_POST['body'];
// $grpid = $_POST['grpid'];
// $seen = $_POST['seen'];
// $fromid =$_SESSION["id"];
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed:". $conn->connect_error);
}
$sql = "SELECT * FROM position";
// $sql = "UPDATE grpchatseen SET seen=1 where toid='$fromid' AND grpid='$grpid'";
// $sql = "UPDATE messages SET seento=1 where grpid='$grpid' AND ";
$result = $conn->query($sql);
// if ($result->num_rows > 0) {
// // output data of each row
// while($row = $result->fetch_assoc()) {
// echo "id: " . $row["id"]. " - Name: " . $row["username"]. " ". "<br>";
// }
// } else {
// echo "0 results";
// }
// $tname = array();
// $tpost= array();
// $fromid =$_SESSION['id'];
// $result=getmembers($n);
$i=0;$temp="";
if ($result->num_rows > 0) {
while($row = $result->fetch_assoc()) {
// $tname[$i]=$row["name"];
// $tpost[$i]=$row["position"];
// $i++;
$temp=$temp.'"'.$row["name"].'":'.'"'.$row["position"].'",';
}
}
echo $temp;
$conn->close();
return $result;
?>