get_video_search.php 556 B

123456789101112131415161718192021
  1. <?php
  2. if (isset($_POST["search"])) {
  3. include("../connectSQL_Component.php");
  4. $search = $_POST["search"];
  5. $file_tables = [];
  6. $array = [];
  7. $sql = "SELECT [id],[title], [file_path] FROM [BIMComponents].[dbo].[Video_Table]
  8. WHERE [title] like '%".$search."%';";
  9. $fetchResult = sqlsrv_query($conn, $sql);
  10. while ($row = sqlsrv_fetch_array($fetchResult, SQLSRV_FETCH_ASSOC)) {
  11. array_push($file_tables, $row);
  12. }
  13. $array["file_tables"] = $file_tables;
  14. echo json_encode($array);
  15. sqlsrv_close($conn);
  16. }