forked from Namslay26/E-Learning-Website
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprofile.php
34 lines (26 loc) · 997 Bytes
/
profile.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
<?php
$exists=false;
$data = json_decode(file_get_contents("php://input"));
include 'dbconnect.php';
$email=$data->email;
$sql1 = "Select * from register where Email='$email'";
$sql2 = "Select * from userInfo where Email='$email'";
$result1 = mysqli_query($conn, $sql1);
$result2 = mysqli_query($conn, $sql2);
$num = mysqli_num_rows($result1);
if($num) {
if($exists==false) {
$row1 = mysqli_fetch_array($result1);
$row2 = mysqli_fetch_array($result2);
$name=$row1['UserName'];
$phone=$row1['Phone'];
$clg=$row1['CollegeName'];
$deg=$row1['DegreeName'];
$reg=$row2['coursesRegistered'];
$comp=$row2['CoursesCompleted'];
header( "Content-type: application/json" );
$jsonAnswer = array('name' => $name,'phone' => $phone,'clg' => $clg,'deg' => $deg,"reg" => $reg,'comp' => $comp);
echo json_encode($jsonAnswer);
}
}
?>