php - Notice: Undefined variable: displaydata

one text

Solution:

Your function.php

public function DisplayData() {
        try{
            $db = getDB();
            $displaydata = $db->prepare('SELECT * FROM tasks ORDER BY created ASC');
            $displaydata->execute();                
            while($row = $displaydata->fetch(PDO::FETCH_ASSOC)) {  
              if($row['created'] < date('Y-m-d')) {
                 echo 'TEST';
                 }
               }    
    }
    catch(PDOException $e) {
        echo '{"error":{"text":'. $e->getMessage() .'}}';
    }
}

Your Html file:

<?php
include('php/functions.php');
?>

<!doctype html>
<html ng-app>
  <head>
    <title>Opgaver</title>
    <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.6/angular.min.js"></script>
  </head>
  <body>
  </body>
</html>

<?php
$fun= new Functions();
$fun->DisplayData();

 ?>

Source