PHP 数组格式错误

PHP Array in wrong format

我有一个查询,我希望将结果插入数组中,所以毕竟我会将其编码为 JSON,但我的问题是我希望数据像这样设置:

array[0] = project1, project2, project3; array[1] = item1, item2, item3;

我有这个:

array[0] = project1; array[1] = project2; array[2] = project3;

等等..

这是我目前所做的:

$info = array();

    $items = mysql_query("SELECT * FROM `vision`.`projects` WHERE  proj_area = 'area_1'");

        if (mysql_num_rows($items) != 0) { 
            while($proj = mysql_fetch_array($items)) {      

            $proj_name = $proj['proj_name'];
            $proj_beg = $proj['proj_beg'];
            $proj_end = $proj['proj_end'];

            array_push($info, $proj_name, $proj_beg, $proj_end );
        } 
    }

    echo json_encode($info);

我的查询结果给了我这些结果:

["nome", "0000-00-00", "0000-00-00", "Projeto 2", "2016-12-12", "2020-07-30", "Projeto", "2017-02-03", "2018-03-10"]

这是我的 $.getJSON 代码:

$.getJSON("includes/get_area.php",function(data){

                    console.log(data);
                    })

我做错了什么?

试试这个;这将在三个数组索引中的每一个中添加一个列表。

$info = array();

$items = mysql_query("SELECT * FROM `vision`.`projects` WHERE  proj_area = 'area_1'");
if (mysql_num_rows($items) != 0) {
    while($proj = mysql_fetch_array($items)) {
        $info[0][] = $proj['proj_name'];
        $info[1][] = $proj['proj_beg'];
        $info[2][] = $proj['proj_end'];
    }
}

echo json_encode($info);