MySQL: “The SELECT would examine more than MAX_JOIN_SIZE rows”

后端 未结 6 1955
长情又很酷
长情又很酷 2020-12-01 18:36

I am using PHP and MySQL. In my program there is a select query involving joins. When I run it on localhost it\'s working fine but when I upload it on my server and try to e

6条回答
  •  無奈伤痛
    2020-12-01 19:20

    When using PHP, SQL_BIG_SELECTS=1 should be set in a separate query before your main query. For example:

    $mysqli = new mysqli("localhost", "root", "password", "db"); 
    
    $mysqli->query("SET SQL_BIG_SELECTS=1");  //Set it before your main query
    
    $results = $mysqli->query("SELECT a, b, c FROM test");
    while($row = $results->fetch_assoc()){
        echo '
    ';
        print_r ($row);
        echo '
    '; }

提交回复
热议问题