使用php或mysql向来自不同数据库的数据添加排序和分页 [英] Adding sorting and pagination to data from different DB using php or mysql

查看:256
本文介绍了使用php或mysql向来自不同数据库的数据添加排序和分页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的任务是从不同服务器中的不同数据库中获取数据并在单个网页中显示它们.我正在joomla工作,并且能够使用每个数据库的单独查询从数据库中获取数据.是我需要对该网页进行排序和分页.由于所有数据库都包含大量数据,我该如何做到这一点而不会造成任何性能问题. 或者我可以对此使用单个sql查询吗?

My task is to take data from different databases in different server and to display them in a single web page.I am working in joomla and i am able to take data from the databases using separate queries for each database.But the problem is that i need to give sorting and pagination to this web page. how can i do this without making any performance issue since all the databases contains a lot of data. Or can i use a single sql query for this ??

推荐答案

要执行您在Joomla中描述的内容,我建议使用

To do what you're describing in Joomla I would recommend the Fabrik extension. It lets you create fairly complex front-end visualizations and table views of database data, as well as search forms and single-page table views that have nice ordering/sorting/per-column filtering controls.

更重要的是,Fabrik使您可以建立与多个数据库的连接.在Fabrik中设置所有数据库连接后,即可在Fabrik后端中导入和配置这些表,然后,管理界面的其他部分将它们视为相同.

More importantly, Fabrik lets you set up connections to multiple databases. Once you've set up all your database connections in Fabrik, you can then import and configure those tables in the Fabrik back-end, and after that they are all treated the same by the other parts of the administrative interface.

换句话说,您可以在Fabrik后端中创建前端表视图或搜索表单,这可以执行跨多个数据库连接的表联接或使用以下操作从一个数据库中预过滤表的结果集之类的操作:数据存储在另一个数据库中(其中包括),而Fabrik将负责为您创建和关闭必要的数据库连接.

In other words, you can create front-end table views or search forms in the Fabrik back-end, which can do things like table joins across multiple database connections, or pre-filter result sets of a table from one database using data stored in another database (among other things) and Fabrik will take care of creating and closing the necessary database connections for you.

这篇关于使用php或mysql向来自不同数据库的数据添加排序和分页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆