in reply to Re^15: CGI Action call
in thread CGI Action call
Because although the correct surname is 'Dare' your sql is using 'Dare"'. The next record to 'Dare"' will be 'Ebert', the " makes no difference. The previous record to 'Dare' using the sql < 'Dare"' will be 'Dare' so it becomes stuck
Looking at the code you posted Re^6: CGI Action call
#Last record Tested Good $stmt = "SELECT * FROM ( SELECT * FROM users WHERE $searchfield <= ? AND $searchfield >= ? ORDER BY $searchfield DESC LIMIT 1 ) sub ORDER BY $searchfield ASC"; #example lastname SELECT * FROM ( SELECT * FROM users WHERE lastname >='z%' AND lastname >= 'a%' ORDER BY user_id DESC LIMIT 1 ) sub ORDER BY lastname ASC #Works fine hard coded
The hard coded version has a mistake with >='z%' which should be <= as in the $stmt. Correcting that mistake would give you
SELECT * FROM ( SELECT * FROM users WHERE lastname <='z%' AND lastname >= 'a%' ORDER BY user_id DESC LIMIT 1 ) sub ORDER BY lastname ASC
But, if you think that works correctly then add the name 'Ryan Zimmerman' to you user table and try navigating to last record. Then try the simpler
SELECT * FROM users ORDER BY lastname DESC LIMIT 1
Whilst this is SQL and not perl, applying the KISS_principle to both makes bugs more easily tracked down.I suspect there are more depending on how you are persisting the sort order between cgi calls
poj
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^17: CGI Action call
by tultalk (Monk) on Mar 29, 2018 at 17:32 UTC | |
|
Re^17: CGI Action call
by tultalk (Monk) on Mar 30, 2018 at 11:02 UTC | |
by poj (Abbot) on Mar 30, 2018 at 11:20 UTC | |
by tultalk (Monk) on Mar 30, 2018 at 18:37 UTC | |
by poj (Abbot) on Mar 30, 2018 at 20:32 UTC | |
by tultalk (Monk) on Apr 01, 2018 at 01:16 UTC | |
by poj (Abbot) on Apr 01, 2018 at 19:06 UTC | |
| |
by tultalk (Monk) on Mar 30, 2018 at 23:19 UTC | |
|
Re^17: CGI Action call
by tultalk (Monk) on Mar 29, 2018 at 16:50 UTC | |
|
Re^17: CGI Action call
by tultalk (Monk) on Mar 29, 2018 at 16:59 UTC |