Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/271.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 DB连接两个表_Php_Database_Zend Framework_Select_Join - Fatal编程技术网

Php 选择使用Zend DB连接两个表

Php 选择使用Zend DB连接两个表,php,database,zend-framework,select,join,Php,Database,Zend Framework,Select,Join,我有两个表:用户和用户配置文件: users: (user_id, email, password, created_date) user_profile: (user_id, first_name, last_name, address, birthday) 使用Zend DB select,我希望像这样连接这两个表 INNER JOIN `users` ON `users`.`user_id`=`user_profile`.`user_id` 现在的问题是,我不知道如何通过使用Zend

我有两个表:用户和用户配置文件:

users: (user_id, email, password, created_date)

user_profile: (user_id, first_name, last_name, address, birthday)
使用Zend DB select,我希望像这样连接这两个表

INNER JOIN `users` ON `users`.`user_id`=`user_profile`.`user_id`
现在的问题是,我不知道如何通过使用Zend_Db实现Select join。 请帮帮我。非常感谢你

$select = $this->select()
                ->from('users')
                ->joinLeft(array('userprofile'=>'user_profile'),'users.user_id = userprofile.user_id')
                ->where('users.user_id = ?', 1);   
这就是在zend中连接两个表的方式。查看ZF手册了解zend join的使用情况

这就是在zend中连接两个表的方式。查看ZF手册了解zend join的使用情况