Php 当我回显Zend#u Db查询时,它包含';关于数组';,为什么?
Sql查询: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
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放在那里会发生什么?