-
Notifications
You must be signed in to change notification settings - Fork 0
/
st_profile.php
40 lines (39 loc) · 1.02 KB
/
st_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
35
36
37
38
39
40
<?php
try{
ini_set( "display_errors", 0);
include 'db_init.php';
session_start();
$link=new mysqli("localhost", "root", '', "councelling");
$stmt=$link->prepare("select * from student where sid=?");
$id=$_SESSION["id"];
$stmt->bind_param("s", $id);
$result=$stmt->execute();
//print_r($id);
$result=$stmt->get_result();
if($result->num_rows>0){
$row=$result->fetch_assoc();
$out="";
$keys= array_keys($row);
foreach($keys as $key){
$out=$out."<tr>
<th>".$key."</th>
<td>".$row[$key]."</td>
</tr>";
}
libxml_use_internal_errors(true);
$html = 'st_profile.html';
$dom = new DOMDocument();
$dom->loadHTMLFile($html);
$node = $dom->getElementById('mydata');
$fragment = $dom->createDocumentFragment();
$fragment->appendXML($out);
$node->appendChild($fragment);
echo $dom->saveHTML();
}
else
throw new Exception ("Session expired.");
} catch (Exception $ex) {
include 'profile.html';
echo '<script>alert("'.$ex->getMessage().'")</script>';
}
?>