We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 3749
    • 24,544 Posts
    I'm not sure I understand your database design, but I think you might need a more complex design with more tables and intersect tables for the many-to-many relationships.

    For example:

    Main Tables
    ---------
    runners
    races
    stations
    times

    Intersect Tables
    ----------------------
    raceTimes
    raceRunners
    raceStations
    runnerTimes
    stationTimes

    That way you could pull the times for a particular runner, information about a particular race, the times for a particular station in a particular race, or the runners in a particular race and their stations times, etc. much faster than having to wade through every record in the DB for any kind of data.

    I used to know a lot more about database design than I do now. I haven't done anything complex for a long time, so I could be full of crap here.

    I think your print_r() statement is also taking a lot of time.


    ---------------------------------------------------------------------------------------------------------------
    PLEASE, PLEASE specify the version of MODX you are using . . . PLEASE!
    MODX info for everyone: http://bobsguides.com/modx.html
      Did I help you? Buy me a beer
      Get my Book: MODX:The Official Guide
      MODX info for everyone: http://bobsguides.com/modx.html
      My MODX Extras
      Bob's Guides is now hosted at A2 MODX Hosting
      • 34012
      • 88 Posts
      If you are running the code as snippet, few things catch my eye.

      1. Like Bob mentioned, the print_r()'s, do not print_r() any object.. You'll just get in to trouble straight away.
      2. Do not echo anything. The output needs to be returned from snippet.
      3. If that is the full snippet. Where are next variables set? $race, $raceId

      For print_r(). You can return a print_r() result using flag true. Example:
      return print_r($something, true);


        Almost retired from web-development industry but still randomly writing at Lazylegs.info and on schedule hopefully in near future to finish Oracle and PostgreSQL ports of MODX
        • 34004
        • 125 Posts
        Thanks bob and lazy legs- it was the printr. It was trying to output the entire resource tree for some reason.

        I got it all working as expected. Once again thanks for the help!
          • 3749
          • 24,544 Posts
          I'm glad you got it working. Thanks for reporting back. smiley


          ---------------------------------------------------------------------------------------------------------------
          PLEASE, PLEASE specify the version of MODX you are using . . . PLEASE!
          MODX info for everyone: http://bobsguides.com/modx.html
            Did I help you? Buy me a beer
            Get my Book: MODX:The Official Guide
            MODX info for everyone: http://bobsguides.com/modx.html
            My MODX Extras
            Bob's Guides is now hosted at A2 MODX Hosting