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
|
<?php /* $DB = new mysqli('localhost', 'root', '', 'pathwaysmisdb'); if (mysqli_connect_errno()) { echo 'File Connect' . mysqli_connect_error(); exit(); } */ include_once '../include/DBConnect.php';
//if ($_POST['PID']) { // $PID = $_POST['PID']; //$Name = 'Lok'; //$query = "select * from product where Product_ID='$PID'"; //$query = "select * from subject where deleted = '0'"; //$result = $dbh->query($query); $Arrays= array(); $deleted = 0; $query = "select * from subject where deleted = ? ORDER BY sort"; $result = $dbh->prepare($query); $result->bindParam(1,$deleted); $result->execute();
$subject = $result->fetchAll(); foreach ($subject as $value) { echo json_encode($value); } //while ($row = $result->fetch_object()) { /* while ($row = $result->fetch(PDO::FETCH_OBJ)) { $ID = $row->subject_id; $PDes = $row->sub_name; $PC = $row->code; $Array = array( "subject_ID" => $ID, "subject_Description" => $PDes, "subject_code" => $PC,
); $Arrays[] = $Array; }*/ //mysqli_close($dbh); /* foreach ($Arrays as $value) { echo json_encode($value); }*/ //echo json_encode($Arrays[0]); //echo json_encode($Arrays[1]); //echo json_encode($Arrays[2]);
//} ?>
|