From: Will Budic Date: Fri, 11 Oct 2019 21:49:55 +0000 (+1100) Subject: upd, foward paging now olny working. X-Git-Url: https://lifelog.hopto.org/gitweb/?a=commitdiff_plain;h=ab7ada0f0a974e910c87cd538fb40716c7669a88;p=LifeLog.git upd, foward paging now olny working. --- diff --git a/htdocs/cgi-bin/main.cgi b/htdocs/cgi-bin/main.cgi index 717cffa..ee2515e 100755 --- a/htdocs/cgi-bin/main.cgi +++ b/htdocs/cgi-bin/main.cgi @@ -325,14 +325,19 @@ qq(
prepare($stmt); - $rv = $st->execute() or die or die "

Error->" & $DBI::errstri & "

"; - if ( $rv < 0 ) { - print "

Error->" & $DBI::errstri & "

"; - } + #SELECT rowid, ID_CAT, DATE, LOG, AMOUNT, AFLAG, RTF, STICKY from LOG where rowid <= '40' and STICKY == 0 ORDER BY DATE DESC; + if(index ($stmt, 'rowid <=') < 1){ + + $stmt = "SELECT rowid, ID_CAT, DATE, LOG, AMOUNT, AFLAG, RTF, STICKY FROM LOG WHERE STICKY != 1 ORDER BY DATE DESC, rowid DESC;"; + # print $cgi->pre("###2 -> ".$stmt); + $st = $db->prepare($stmt); + $rv = $st->execute() or die or die "

Error->" & $DBI::errstri & "

"; + if ( $rv < 0 ) { + print "

Error->" & $DBI::errstri & "

"; + } - &buildLog; + &buildLog; + } sub buildLog { @@ -845,20 +850,9 @@ $sm_reset_all undef($sss); exit; -=comm -sub parseDate{ - my $date = $_[0]; -try{ -return DateTime::Format::SQLite->parse_datetime( $date ); -} -catch{ - print "SERVER ERRORdate:$date]->".$_; -} -return $today; -} -=cut - sub processSubmit { + +sub processSubmit { my $date = $cgi->param('date'); my $log = $cgi->param('log'); @@ -914,7 +908,7 @@ return $today; else { $rs_page++; } - $stmt = qq(SELECT rowid, ID_CAT, DATE, LOG, AMOUNT, AFLAG, RTF, STICKY from LOG where rowid <= '$rs_cur' ORDER BY STICKY DESC, DATE DESC;); + $stmt = qq(SELECT rowid, ID_CAT, DATE, LOG, AMOUNT, AFLAG, RTF, STICKY from LOG where rowid <= '$rs_cur' and STICKY != 1 ORDER BY DATE DESC;); return; } } @@ -1004,8 +998,8 @@ return $today; } catch { print "ERROR -> " . $_; - } - } + } +} sub buildNavigationButtons {