Support » Plugin: SportsPress - Sports Club & League Manager » Database Error with tables

  • Hi guys,

    I was trying to build a new site with sportspress, having already some experience from another one. First everything was working fine. Then after manually putting in all my data for players, leagues, positiones and so on, I came upon the teams. As I was doing them, it first worked. Then I trid clicking on one of them and my site went blank. The database got an error. My support from the hosting said, the database was not closing a comand and went looping. They have sent me the comand that was not closing:

    SELECT DrTT1_posts.* FROM DrTT1_posts LEFT JOIN DrTT1_term_relationships ON
    (DrTT1_posts.ID = DrTT1_term_relationships.object_id) LEFT JOIN
    DrTT1_term_relationships AS tt1 ON (DrTT1_posts.ID = tt1.object_id) INNER JOIN
    DrTT1_postmeta ON ( DrTT1_posts.ID = DrTT1_postmeta.post_id ) INNER JOIN
    DrTT1_postmeta AS mt1 ON ( DrTT1_posts.ID = mt1.post_id ) INNER JOIN
    DrTT1_postmeta AS mt2 ON ( DrTT1_posts.ID = mt2.post_id ) INNER JOIN
    DrTT1_postmeta AS mt3 ON ( DrTT1_posts.ID = mt3.post_id ) INNER JOIN
    DrTT1_postmeta AS mt4 ON ( DrTT1_posts.ID = mt4.post_id ) INNER JOIN
    DrTT1_postmeta AS mt5 ON ( DrTT1_posts.ID = mt5.post_id ) INNER JOIN
    DrTT1_postmeta AS mt6 ON ( DrTT1_posts.ID = mt6.post_id ) INNER JOIN
    DrTT1_postmeta AS mt7 ON ( DrTT1_posts.ID = mt7.post_id ) INNER JOIN
    DrTT1_postmeta AS mt8 ON ( DrTT1_posts.ID = mt8.post_id ) INNER JOIN
    DrTT1_postmeta AS mt9 ON ( DrTT1_posts.ID = mt9.post_id ) INNER JOIN
    DrTT1_postmeta AS mt10 ON ( DrTT1_posts.ID = mt10.post_id ) INNER JOIN
    AS mt11 ON ( DrTT1_posts.ID = mt11.post_id ) INNER JOIN DrTT1_postmeta AS mt12 ON
    ( DrTT1_posts.ID = mt12.post_id ) INNER JOIN DrTT1_postmeta AS mt13 ON (
    DrTT1_posts.ID = mt13.post_id ) INNER JOIN DrTT1_postmeta AS mt14 ON (
    DrTT1_posts.ID = mt14.post_id ) INNER JOIN DrTT1_postmeta AS mt15 ON (
    DrTT1_posts.ID = mt15.post_id ) INNER JOIN DrTT1_postmeta AS mt16 ON (
    DrTT1_posts.ID = mt16.post_id ) INNER JOIN DrTT1_postmeta AS mt17 ON (
    DrTT1_posts.ID = mt17.post_id ) INNER JOIN DrTT1_postmeta AS mt18 ON (
    DrTT1_posts.ID = mt18.post_id ) INNER JOIN DrTT1_postmeta AS mt19 ON (
    DrTT1_posts.ID = mt19.post_id ) INNER JOIN DrTT1_postmeta AS mt20 ON (
    DrTT1_posts.ID = mt20.post_id ) WHERE 1=1 AND (
    DrTT1_term_relationships.term_taxonomy_id IN (18) AND tt1.term_taxonomy_id IN
    (13) ) AND ( ( DrTT1_postmeta.meta_key = ‘sp_format’ AND
    DrTT1_postmeta.meta_value IN (‘league’) ) AND ( ( mt1.meta_key = ‘sp_team’ AND
    mt1.meta_value IN (‘437’) ) AND ( mt2.meta_key = ‘sp_team’ AND mt2.meta_value IN
    ‘438’) ) AND ( mt3.meta_key = ‘sp_team’ AND mt3.meta_value IN (‘464’) ) AND (
    mt4.meta_key = ‘sp_team’ AND mt4.meta_value IN (‘467’) ) AND ( mt5.meta_key =
    ‘sp_team’ AND mt5.meta_value IN (‘455’) ) AND ( mt6.meta_key = ‘sp_team’ AND
    mt6.meta_value IN (‘468’) ) AND ( mt7.meta_key = ‘sp_team’ AND mt7.meta_value IN
    (‘453’) ) AND ( mt8.meta_key = ‘sp_team’ AND mt8.meta_value IN (‘452’) ) AND (
    mt9.meta_key = ‘sp_team’ AND mt9.meta_value IN (‘451’) ) AND ( mt10.meta_key =
    ‘sp_team’ AND mt10.meta_value IN (‘446’) ) AND ( mt11.meta_key = ‘sp_team’ AND
    mt11.meta_value IN (‘445’) ) AND ( mt12.meta_key = ‘sp_team’ AND mt12.meta_value
    IN (‘444’) ) AND ( mt13.meta_key = ‘sp_team’ AND mt13.meta_value IN (‘443’) ) AND
    ( mt14.meta_key = ‘sp_team’ AND mt14.meta_value IN (‘442’) ) AND ( mt15.meta_key
    = ‘sp_team’ AND mt15.meta_value IN (‘462’) ) AND ( mt16.meta_key = ‘sp_team’ AND
    mt16.meta_value IN (‘399’) ) AND ( mt17.meta_key = ‘sp_team’ AND mt17.meta_value
    IN (‘461’) ) AND ( mt18.meta_key = ‘sp_t
    eam’ AND mt18.meta_value IN (‘460’) ) AND ( mt19.meta_key = ‘sp_team’ AND
    mt19.meta_value IN (‘459’) ) AND ( mt20.meta_key = ‘sp_team’ AND mt20.meta_value
    IN (‘457’) ) ) ) AND DrTT1_posts.post_type = ‘sp_event’ AND
    ((DrTT1_posts.post_status = ‘publish’ OR DrTT1_posts.post_status = ‘future’))
    GROUP BY DrTT1_posts.ID ORDER BY DrTT1_posts.post_date DESC

    Can u get a grip of it? It is always occuring when I try to look at some teams in my sportspress library. I think it has something to do with leagues. Because in the query above mentioned there are 20 things. My table is 20 teams big. The teams without the table on the screen are working fine, just the two teams where I was showing the table had those failures. Another info is, that I did not implement matches right now, so my table was all things at zero.

    I also tried reinstalling my whole WordPress, get a new database and start from scratch. After I was getting it the second time now and never had any problemes before I am realllly frustrating – as u can imagine.

    Can you help me? Maybe point me in the right direction as how to further debugg that problem? Can u check it, if there is a problem with tables that dont have any games played yet? I have zero problems on my site, exepct that one with sportspress…

    hope to hear from you, thank you for that awesome plugin and your work!

Viewing 15 replies - 1 through 15 (of 24 total)
  • Plugin Support Roch



    Thanks for reaching out and I’m sorry for the trouble.

    Please try disabling all other plugins and make sure you are using a sportspress-compatible theme (preferably rookie or twenty sixteen) while testing.


    Kind Regards,

    Hey Roch, I was just getting the same error in my database with theme twenty sixteen and NO other plugin activated… just raw sportspress. Had to call my support to kill the “looping” (non functioning) request again on the server.

    I did only open up a league table and when watching the page with the league, it is getting that bad DB request.

    My teams are fine, I can look at them (all now) since I removed showing the tables in the main setting of the teams, that I had on before. So every team page without showing a table was working, those two teams with a table on the page, looped. So the tables seem to be corrupt. If I would not using tables at all, my site would be running smoothly without any error. The other functionalites seem to work.

    I also got know the error message myserver..xxxxx/wp-includes/wp-db.php on line 1877

    That is immediatly after trying to create a table. Can you please investigate? seems to be the query call

    private function _do_query( $query ) {
    		if ( defined( 'SAVEQUERIES' ) && SAVEQUERIES ) {
    		if ( ! empty( $this->dbh ) && $this->use_mysqli ) {
    			<strong>$this->result = mysqli_query( $this->dbh, $query );</strong>
    		} elseif ( ! empty( $this->dbh ) ) {
    			$this->result = mysql_query( $query, $this->dbh );
    		if ( defined( 'SAVEQUERIES' ) && SAVEQUERIES ) {
    			$this->queries[] = array( $query, $this->timer_stop(), $this->get_caller() );

    EDIT: $this->result = mysqli_query( $this->dbh, $query ); (I foolishly tried to mark that part of the code, which insertet the strong thing 🙂 Sry…

    To the last part, I acutally dont know if I just received that message, after my sup killed the looping DB… I just wanted to tell you.

    Roch do you have any news on this topic? I am still having these failures. I have tried a lot now, without any success… as soon as I am adding teams to my table and hit “save” not even publish, it is crushing the database query.

    Yep exact same issue.

    Disabled all other plugins and having the same issue.

    My host also said that opening the League Table view is causing severe load on the SQL due to a connection not closing.

    Plugin Support Roch


    Hi guys!

    Thanks for your input. I’m sending this to our dev team so they can check as I don’t see this at my localhost


    Kind Regards,


    I am having the same problem. Has anyone made progress? If I add a 10th team to a league table, my database becomes overwhelmed and crashes the site.



    Nope, unfortunately I could not keep using the tables. As everytime I opened that request, the whole page went roque. I was gettin tired of calling my host to disable the MySQL request.

    I have not heared from roch or anyone else. But, as we are three guys now, at least, I am very confident, that this is an issue with sportspress unfortunately.

    I hope they will fix this.

    I am on php 7 if that helps anyone… Maybe more people have to have this issue, for them do react. I dont know.

    • This reply was modified 2 years, 11 months ago by Pa7rocK.

    Do any of you have the Tie-breaker option enabled? Try turning it off and trying again. That’s what did it for me when mine would ‘loop’.

    That’s done it! I disabled the head to head and now I am good to go.

    Thank you so much!

    Plugin Contributor Savvas


    The Tie-Breaker option is a “must” setting for football leagues.

    What is the developer opinion on this “performance” problem?

    I have had the same issue and 8 teams in a table is fine the 9th slows things down and a 10th sends it into a loop. (not great when you have 12 team leagues) Have contacted support and they are looking at the issue but it definitely is to do with the “tie-break” being turned on – switch it off and all works. Head to head tie-breaks are essential so I hope they fix it soon but for now I need to manually check and edit the table for this.

    Yes I can also say, that unchecking the tie break did the job for me. So this is definetly the issue… now that we all know what is causing this, hopefully the devs can make it work.

    Thank you all for your replys. I do not mark this topic resolved – yet. Beacause, well it isn’t yet 🙂 But we got a work around. Thank you.

    I have same problem after adding players… how to fix?

Viewing 15 replies - 1 through 15 (of 24 total)
  • The topic ‘Database Error with tables’ is closed to new replies.