数组到无序列表

时间:2018-07-05 12:10:21

标签: arrays json database list unordered

我一直试图将数组放入无序列表。 它是用php和json制成的,数据是从数据库中获取的。

    //setting header to json
header('Content-Type: application/json');

//database
define ('DB_HOST', '');
define ('DB_USERNAME', '');
define ('DB_PASSWORD', '');
define ('DB_NAME', '');

//get connection
$mysqli = new mysqli(DB_HOST, DB_USERNAME, DB_PASSWORD, DB_NAME);

if(!$mysqli){
  die("Connection Failed: " . $mysqli -> error);
}


 //query to get data from the table
    $query = sprintf("SELECT ACTION AS ToDo FROM `employees_pdp_actions` WHERE notes = 'it-todo' OR notes = 'finance-todo' OR notes = 'sales-todo' OR notes = 'hrm-todo' ORDER BY end_date ASC");

    //execute query
    $result = $mysqli -> query($query);

    //loop through the returned data
    $data = array();
    foreach ($result as $row) {
      $data[] = $row;
    }

我似乎无法找到解决方法。

0 个答案:

没有答案