PDO has a limit bug (MySQL)
The data type needs to be specified, and the two parameters following limit must be numerical. Otherwise, no data can be obtained.
Example 1:
$ DSN = "MYSQL: host = 127.0.0.1; Port = 3306; dbname = dab"; $ DBH = new PDO ($ DSN, 'root ',''); $ SQL = "select * From dab_ntos_admin limit ?,? "; $…… = $ DBH-> prepare ($ SQL); $……> bindvalue (1, + '0', PDO: param_int ); // The third parameter specifies the parameter type, and the second parameter converts the type (converted to the numerical type) with the plus sign $ something-> bindvalue (2, + '1', PDO:: param_int); // The third parameter specifies the parameter type, and the second parameter converts the type (converted to a value type) with the plus sign (+) $ something-> execute (); foreach ($ something as $ row) {echo var_dump ($ row );}
Example 2:
$ DSN = "MYSQL: host = 127.0.0.1; Port = 3306; dbname = dab"; $ DBH = new PDO ($ DSN, 'root ',''); $ SQL = "select * From dab_ntos_admin limit: Start,: Limit"; $…… = $ DBH-> prepare ($ SQL); $ ...... bindvalue (': start ', + '0', PDO: param_int); // The third parameter specifies the parameter type, and the second parameter is converted to the value type with the + sign) $ something-> bindvalue (': Limit', + '1', PDO: param_int); // The third parameter specifies the parameter type, the second parameter is converted to a numeric value using the plus sign (+) $ something-> execute (); foreach ($ something as $ row) {echo var_dump ($ row );}
PDO limit bug