phpMyEdit - Viewing Bug Advanced Details [ Go Back ]
452 core / field option minor always 2007-09-06 05:56 2007-09-06 05:56
chriss4242  
 
normal  
new 5.7 (stable)  
open  
none  
none  
"Number of records to display on the screen" doesn't appear to work.
When "$opts['inc'] = 15;" is set, the page returns with a 1064 sql error:

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'LIMIT 0, 15' at line 1

The query being executed was:

SELECT `PMEtable0`.`scriptname` AS `qf0`,`PMEtable0`.`version` AS `qf1`,`PMEtable0`.`date` AS `qf2`,`PMEtable0`.`priority` AS `qf3`,`PMEtable0`.`description` AS `qf4`,`PMEtable0`.`id` AS `qf5` FROM `current_versions` AS `PMEtable0` ORDER BY `PMEtable0`.`id` LIMIT LIMIT 0, 153.735 miliseconds

Use "phpMyEditSetup.php" to create a form using default of 15 lines per screen.
I get the above error.
Redo form with unlimited lines per page and everything works as expected.
Apply fix below and everything works as expected.
When I had a look at the code, the LIMIT construct appears to being set in two locations - Line 358 and also 570 in phpMyEdit.class.php. (Both when constructing the query and also in the parts being placed into the query.

I made the following change to remove it from one of the locations and it appears to work correctly now:

[xxx@xxx phpMyEdit-5.7]# diff phpMyEdit.class.php phpMyEdit.class.php.mod
358c358,363
< return ' LIMIT '.$start.', '.$more.' ';
---
> /* Modified by CJS. parts['limit'] appears to add "LIMIT" and so does the main query constructor. Result was
> limit being included twice. Modified here so that the query parts does not ad LIMIT key word.
>
> return ' LIMIT '.$start.', '.$more.' ';
> */
> return $start.', '.$more.' ';
[xxx@xxx phpMyEdit-5.7]#

Hope this helps.

There are no notes attached to this bug.