Adding sorting and pagination to data from different DB

Discussion in 'PHP' started by anuja12, May 13, 2011.

  1. #1
    My task is to take data from different databases in different servers 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 ??
     
    anuja12, May 13, 2011 IP
  2. anwaraa

    anwaraa Active Member

    Messages:
    167
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    90
    Digital Goods:
    2
    #2
    I assume you know about having set permissions to do remote mysql. If you can, then use curl to retrieve data but will need to do one each for each server. Then sort the data on your php page into arrays and then paginate from there.
     
    anwaraa, May 13, 2011 IP
  3. Jane Management

    Jane Management Peon

    Messages:
    6
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    You can make it a one-liner but never a single SQL query.
     
    Jane Management, May 13, 2011 IP
  4. JoelLarson

    JoelLarson Peon

    Messages:
    61
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Are you trying to pull data from multiple databases with a similar table schema or data from multiple databases with different table schema?

    A way to speed up transfer between sites that have databases that travel over the internet (through DNS and all the routing) would be to use persistent MySQL connections in PHP. http://php.net/mysql_pconnect

    I'll give you some more input on what to do once my first question is answered. :)
     
    JoelLarson, May 13, 2011 IP
  5. Projekt.Gopher

    Projekt.Gopher Peon

    Messages:
    36
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    If you're looking to sort and paginate from different databases, it might be useful to instead simply use PHP to retrieve the data, and parse one huge table with all the info from each database one after the other, then use one of the many fantastic Jquery table sorting and pagination plugins to do the rest.
     
    Projekt.Gopher, May 14, 2011 IP
  6. anuja12

    anuja12 Guest

    Messages:
    5
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    But each of the database contains a large amount of data..each database will have like 100 entries every day and here i am using 12 databases.so if i try to take all the data from all the databases at a time and then add pagination and sorting ,it will affect the performance of the site.
     
    anuja12, May 16, 2011 IP
  7. anuja12

    anuja12 Guest

    Messages:
    5
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Here i am using databases with similar table schema.I have 12 databases and same table is repeating in all these databases.Each database will have like 100 entries every day.i need to combine data in all these 12 tables and display it in a list.Here i am taking data from the tables using 12 separate queries for each database .i need help in adding pagination and sorting to this complete list
     
    anuja12, May 16, 2011 IP
  8. anuja12

    anuja12 Guest

    Messages:
    5
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #8
    curl is used to retrieve data using URL , right?.so here i will have to retrieve all the data from the 12 databases separately and make it into a list. so will it make any difference.because i am able to take all the data from the databases using joomla.i am having problem with pagination and sorting.all these databases contains a lot of data, so taking all the data will take a lot of time .....:confused:
     
    anuja12, May 17, 2011 IP
  9. anuja12

    anuja12 Guest

    Messages:
    5
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #9
    Is there a approach where we can get data from the databases using XML in PHP
     
    Last edited: May 17, 2011
    anuja12, May 17, 2011 IP