Guest User

Untitled

a guest
Jan 21st, 2018
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.36 KB | None | 0 0
  1. <?php
  2.  
  3. $conn = odbc_connect("$dbq","","");
  4. if($conn){
  5. echo "Connected";
  6.  
  7. }else{
  8.  
  9. echo "Failed";
  10.  
  11.  
  12. }
  13. ?>
  14.  
  15. <?php
  16.  
  17.  
  18.  
  19. include 'Connection.php';
  20.  
  21.  
  22. if(isset($_REQUEST["insert"]))
  23. {
  24. $reg = $_GET['reg'];
  25. $ID = $_GET['ID'];
  26.  
  27. $sql = "select a.RegNo,b.RollNo,c.Standard,d.Division,b.Std_Name as StudentName,AttendanceDate,Attendance_Type,Remark
  28. from (((Attendance_mas as a
  29. inner join Std_Reg as b on a.RegNo = b.RegNo)
  30. inner join StandardMaster as c on a.Standard = c.stdid)
  31. inner join DivisionMaster as d on a.Division =d.DivisionID)
  32. where a.RegNo= '$reg' and a.yearid = '$ID' Order by AttendanceDate desc";
  33. //$sql = "select * from Std_Reg";
  34.  
  35. $stmt = odbc_exec($conn, $sql);
  36. //print_r($stmt);
  37. $result = [];
  38. do {
  39. while ($row = odbc_fetch_array($stmt)){
  40. $result[] = $row;
  41. }
  42. } while (odbc_next_result($stmt));
  43.  
  44. if(count($result)>0)
  45. {
  46. $result1['status']=1;//"Login successfully";
  47. array_push($result1,$result);
  48. }
  49. else
  50. {
  51. //$result[]="null";
  52. $result1['status']=0;//"Record not found";
  53. array_push($result1,$result);
  54. }
  55. odbc_free_result($stmt);
  56. odbc_close($conn); //Close the connnectiokn first
  57.  
  58. echo json_encode($result1); //You will get the encoded array variable
  59. }
  60.  
  61. ?>
Add Comment
Please, Sign In to add comment