Zend_Db,如何使用相关表?
我想学习如何使用ZF中的相关表直到最后。 (1) 谁能帮忙解决这个问题? 有 2 个users 表和 *users_openid* 以及指向许多的链接。我想在 Zend_Db 的表之间实现关系,以便这些用户在 Drugs findDependentRowset 上使用 openid,添加 openid,openid 通过 findParentRow 来引导用户...
该手册是俄语帮助...但不像我无法处理它....( http://framework .zend.com/manual/en/zend.db.table.relationships.html
数据库的结构:
-
- Table structure `users`
-
CREATE TABLE IF NOT EXISTS `users` (
`Id` int (11) UNSIGNED NOT NULL AUTO_INCREMENT,
`Nickname` varchar (200) NOT NULL,
`Email` varchar (200) NOT NULL DEFAULT'',
`Active` tinyint (1) NOT NULL DEFAULT '0 ',
`Enabled` tinyint (1) NOT NULL DEFAULT '0 ',
PRIMARY KEY (`id`)
) ENGINE = InnoDB DEFAULT CHARSET = utf8 AUTO_INCREMENT = 1;
- ------------------------------------------------ --------
-
- Table structure `users_openid`
-
CREATE TABLE IF NOT EXISTS `users_openid` (
`User_id` int (11) UNSIGNED NOT NULL,
`Openid` varchar (200) NOT NULL,
PRIMARY KEY (`user_id`),
KEY `openid` (`openid`)
) ENGINE = InnoDB DEFAULT CHARSET = utf8;
PS另一个小podvoprosik(2),用它你可以创建到MySQL(ubuntu)的连接,工具有phpmyadmin和mysql管理员,但是那里我还没有找到怎么做,但是又不想写sql(
I want to learn to work with related tables in the ZF to the end. (1) Can anyone help with this?
there are 2 users table and *users_openid* with a link to many. I would like to implement a relationship between the tables at Zend_Db so that such users from taking it openid on Drugs findDependentRowset, add openid, openid to take the user through findParentRow ...
The manual is a Russian HELP ... but not like I can not deal with it ....( http://framework.zend.com/manual/en/zend.db.table.relationships.html
The structure of the database:
-
- Table structure `users`
-
CREATE TABLE IF NOT EXISTS `users` (
`Id` int (11) UNSIGNED NOT NULL AUTO_INCREMENT,
`Nickname` varchar (200) NOT NULL,
`Email` varchar (200) NOT NULL DEFAULT'',
`Active` tinyint (1) NOT NULL DEFAULT '0 ',
`Enabled` tinyint (1) NOT NULL DEFAULT '0 ',
PRIMARY KEY (`id`)
) ENGINE = InnoDB DEFAULT CHARSET = utf8 AUTO_INCREMENT = 1;
- ------------------------------------------------ --------
-
- Table structure `users_openid`
-
CREATE TABLE IF NOT EXISTS `users_openid` (
`User_id` int (11) UNSIGNED NOT NULL,
`Openid` varchar (200) NOT NULL,
PRIMARY KEY (`user_id`),
KEY `openid` (`openid`)
) ENGINE = InnoDB DEFAULT CHARSET = utf8;
PS another small podvoprosik (2), with which you are creating a connection to MySQL (ubuntu), the tools have phpmyadmin and mysql administrator, but there I have not found how to do it, but do not want to write sql (
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
回答您的问题,如何创建与数据库的连接?
我知道使用 Zend 连接数据库的两种方法。
zf
配置 db-adapter,然后检索数据库资源在您的 SQL 中,您没有从一个表到另一个表的任何引用...我的参考虚数?无论如何...
或者,查看有关创建选择的 Zend 文档 。您可以在模型中创建选择并加载数据。
矢田
To answer your question, How to create connection to database?
I know 2 ways how to get connection to database using Zend.
zf
and then retrieving the db resource<?php
<?php
In your SQL you do not have any references from one table to another... I the reference imaginary? Anyways...
Alternatively, look at Zend documentation on creating selects. You can create a select in your model and load the data.
YDACHI