|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2005-05-27 08:57 UTC] sniper@php.net
[2005-06-20 06:21 UTC] georg@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 30 00:00:02 2025 UTC |
Description: ------------ When the php.ini "mysql.trace_mode" option is set to true, and you do a mysql_query with SQL_CALC_FOUND_ROWS, the result of a SELECT FOUND_ROWS() will always be 1, no matter how many rows would have been returned (disregarding any LIMIT clause.) changing mysql.trace_mode to false will make it return the correct number. Reproduce code: --------------- ini_set('mysql.trace_mode', true); $result_id = mysql_query('SELECT SQL_CALC_FOUND_ROWS column FROM t LIMIT 5'); $rows = array(); while($row = mysql_fetch_assoc($result_id)) { $rows[] = $row; } $result_id = mysql_query('SELECT FOUND_ROWS()'); list($row_total) = mysql_fetch_row($result_id); Expected result: ---------------- $row_total will be the number of rows returned if there were no LIMIT clause. Actual result: -------------- $row_total is 1, regardless of the actual found rows.