Advertisement
Guest User

Untitled

a guest
Jun 23rd, 2017
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. <?php
  2. error_reporting(-1);
  3. ini_set('display_errors', 'On');
  4. include '../../../dbconfig.php';
  5. $array1= [];
  6. $array2= [];
  7. try
  8. {
  9. $stmt = $db_con->prepare("SELECT * FROM myTable");
  10. $stmt->execute();
  11. if($stmt->rowCount() > 0){
  12. $array1['success']=true;
  13. $array2 = $stmt->fetchAll();
  14. $result=array_merge($array1, $array2);
  15. var_dump(count($result));
  16. //echo json_encode($result);
  17. exit;
  18. }else{
  19. $result=[];
  20. $result['success']=false;
  21. $result['error_msg']="table not found";
  22. echo json_encode($result);
  23. exit;
  24. }
  25. }catch(PDOException $e){
  26. echo $e->getMessage();
  27. }
  28. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement