• hykw

    (@hykw)


    In case SQL_CALC_FOUND_ROWS are used, in the following SELECT FOUND_ROWS() AS totalnums, AS is ignored. It’s correctly set without HyperDB.

    
    global $wpdb;
    
    $sql = "SELECT SQL_CALC_FOUND_ROWS ID FROM wp_posts LIMIT 1";
    $wpdb->get_results($sql);
    
    $sql_total = "SELECT FOUND_ROWS() AS totalnums;";
    $total_records = $wpdb->get_results($sql_total);
    
    print_r($total_records);
    
    array (size=1)
      0 => 
        object(stdClass)[4079]
          public 'FOUND_ROWS()' => string '3' (length=1)
    
  • The topic ‘AS ignored in case SQL_CALC_FOUND_ROWS/FOUND_ROWS()’ is closed to new replies.