remymumoh

Untitled

Sep 20th, 2020
824
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.  
  3. require("connecter.php");  
  4.  
  5. function DataTable_Filling($sqlstr,$Messagein)
  6. {
  7.     $con = connect();
  8.     $json=array();
  9.     try{
  10.     $params = array();
  11.     $options =  array( "Scrollable" => SQLSRV_CURSOR_KEYSET );
  12.     $sel=sqlsrv_query($con, $sqlstr, $params, $options);
  13.     //var_dump($sel);
  14.  
  15.     if(sqlsrv_num_rows($sel) !== false)
  16.     {
  17.         while($row=sqlsrv_fetch_array($sel))
  18.         {  
  19.             $json['results'][]=$row;
  20.         }
  21.         $json['status']='success';
  22.         $json['message']=$Messagein;
  23.     }
  24.     else
  25.     {  
  26.         $json['status']="empty";
  27.     }    
  28.     return json_encode($json);
  29. }catch(Exception $e){
  30.     var_dump($e);
  31. }
  32. }
  33.  
  34. function scalar( $sqlstr,$Messagein)
  35. {
  36.     $con = connect();
  37.     $json=array();
  38.    
  39.     $sel=sqlsrv_query($con,$sqlstr);
  40.     if( $sel === false ) {echo "Error (sqlsrv_query): ".print_r(sqlsrv_errors(), true); exit;}
  41.     if( sqlsrv_num_rows($sel))
  42.     {   $row=sqlsrv_fetch_array($sel);
  43.  
  44.         $json=$row;      
  45.         $json['status']='success';
  46.         $json['message']=$Messagein;
  47.     }
  48.     else
  49.     {  
  50.         $json['status']="error";
  51.         $json['message']="Invalid Request";
  52.     }
  53.          
  54.     return json_encode($json);
  55. }
  56.  
  57.  
  58. function nonqry($sqlstr,$Messagein)
  59. {
  60.    
  61.     $con = connect();
  62.     $params=array();
  63.     $sel = sqlsrv_query($con,$sqlstr);
  64.     $ID = sqlsrv_next_result($sel);
  65.     var_dump($ID);
  66.     $json['ID']=$ID;   
  67.     $json['status']='success';
  68.     $json['message']=$Messagein;
  69.     return json_encode($json);
  70. }
  71.  
  72.  
  73.        
  74. ?>
  75.  
  76.  
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×