Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/ms-access/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 当我回显Zend#u Db查询时,它包含';关于数组';,为什么?_Php_Zend Framework_Zend Db - Fatal编程技术网

Php 当我回显Zend#u Db查询时,它包含';关于数组';,为什么?

Php 当我回显Zend#u Db查询时,它包含';关于数组';,为什么?,php,zend-framework,zend-db,Php,Zend Framework,Zend Db,Sql查询: SELECT test.* FROM test JOIN test_shares WHERE test.test_id = test_shares.test_id AND test_shares.email_address = '$email' AND test.url is NOT NULL ORDER BY title ASC; 重写为Zend\u Db\u Select语句 $select = $db->select () ->from ( 'tes

Sql查询:

SELECT test.* FROM test JOIN test_shares
WHERE test.test_id = test_shares.test_id 
AND test_shares.email_address = '$email' 
AND test.url is NOT NULL ORDER BY title ASC;
重写为
Zend\u Db\u Select
语句

$select = $db->select ()
    ->from ( 'test', 'test.*' )
    ->join ( 'test_shares', array () )
    ->where ( 'test.test_id = test_shares.test_id')
    ->where ( 'test_shares.email_address = ?',  '$email')
    ->where ( 'test.url is NOT NULL')
    ->order ( 'title' );
echo $select;
输出:

SELECT test.* FROM test JOIN test_shares ON Array 
WHERE test.test_id = test_shares.test_id 
AND test_shares.email_address = '$email' 
AND test.url is NOT NULL ORDER BY title ASC
请说明显示此“阵列上”的原因。

尝试以下操作:

$select = $db   ->select ()
    ->from ( 'movie', 'movie.*' )
    ->join(array('movie_shares'),  'movie.movie_id = movie_shares.movie_id');    
    ->where ( 'movie_shares.email_address = ?',  '$email')
    ->where ( 'movie.url is NOT NULL')
    ->order ( 'title' );
echo $select;

您提供了一个数组,其中ON子句需要一个字符串,因此PHP会直接打印
array()
,而不是字符串。

显然这是因为您的->join('movie\u shares',array())。如果你把null放在那里会发生什么?