SQL_CALC_FOUND_ROWS / FOUND_ROWS() does not work in PHP

后端 未结 6 1432
情深已故
情深已故 2020-12-01 14:08

I use SQL_CALC_FOUND_ROWS in Mysql SELECT statement, to get the number of lines my SELECT would return without a LIMIT clause.

$sql = new mysqli         


        
6条回答
  •  甜味超标
    2020-12-01 15:10

    I had the same issue. The solution was stupid, I was using $wpdb->query instead of $wpdb->get_var. So you want to do

    $wpdb->get_var('select FOUND_ROWS()');
    

    if you're on WordPress

提交回复
热议问题