getCompanyData.php 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. include 'db.inc.php';
  3. $id_company = 1;
  4. //get all companies
  5. //get a company's data
  6. $stmt_file = $dbh->prepare(
  7. "SELECT
  8. file_row.id_file_row, file_row.row_number,
  9. file_row.division, file_row.consignee,
  10. DATE_FORMAT(file_row.date_called_in, '%m/%d/%Y') date_called_in,
  11. file_row.dispatch_number, file_row.shipper,
  12. DATE_FORMAT(file_row.date_ready, '%m/%d/%Y') date_ready,
  13. file_row.address_1, file_row.address_2, file_row.city, file_row.state, file_row.zip, file_row.phone,
  14. TIME_FORMAT(file_row.time_ready, '%H:%i %p'),
  15. TIME_FORMAT(file_row.time_close, '%H:%i %p'),
  16. TIME_FORMAT(file_row.time_pickup, '%H:%i %p'),
  17. TIME_FORMAT(file_row.time_depart, '%H:%i %p'),
  18. file_row.bol_delivered,
  19. file_row.dispatch_reference,
  20. file_row.ctns, file_row.weight, file_row.cube
  21. FROM file_row
  22. INNER JOIN file USING(id_file)
  23. WHERE id_company = :id_company");
  24. $stmt_file->execute(array(':id_company' => $id_company));
  25. $rows = $stmt_file->fetchAll(PDO::FETCH_ASSOC);
  26. echo json_encode($rows, JSON_PRETTY_PRINT);
  27. ?>