Well there is 2 mods in the thread we're talking about...
The
whats_new_days mod, That I think you use, Eliot, and the
whats_new_records mod, that would be perfect I think...
I tryed to include
Code:
sub query {
# --------------------------------------------------------
# First let's get a list of database fields we want to search on and
# store it in @search_fields
my ($i, $column, @search_fields, @search_gt_fields, @search_lt_fields, $maxhits, $numhits, $nh,
$field, @regexp, $line, @values, $key_match, @hits, @sortedhits, $next_url, $next_hit, $prev_hit,
$first, $last, $upper, $lower, $left, $right, $restricted);
local (%sortby);
if ($in{'whats_new_days'}) {
$in{'Date-gt'} = &get_date(time() - (($in{'whats_new_days'}+1) * 86400));
}
if ($in{'whats_new_records'}) {
open (DB, "<$db_file_name") or &cgierr("error in search.
unable to open db file: $db_file_name.\nReason: $!");
if ($db_use_flock) { flock(DB, 1); }
@lines = <DB>;
close DB;
$number_of_records = scalar(@lines);
$target_record = $lines[$number_of_records - ($in{'whats_new_records'} + 1)];
@data = &split_decode($target_record);
$in{"$db_key-gt"} = $data[$db_key_pos];
}
# First thing we do is find out what we are searching for. We build a list of fields
# we want to search on in @search_fields.
if ($in{'keyword'}) { # If this is a keyword search, we are searching the same
$i = 0; # thing in all fields. Make sure "match any" option is
$in{'ma'} = "on"; # on, otherwise this will almost always fail.
foreach $column (@db_cols) {
if (($db_sort{$column} eq 'date') or &date_to_unix($in{'keyword'})) { $i++; next; }
if ($i == $auth_user_field) { $i++; next; }
push (@search_fields, $i); # Search every column
$in{$column} = $in{'keyword'}; # Fill %in with keyword we are looking for.
$i++;
}
}
else { # Otherwise this is a regular search, and we only want records
$i = 0; # that match everything the user specified for.
foreach $column (@db_cols) {
if ($in{$column} =~ /^\>(.+)$/) { ($db_sort{$column} eq 'date') and (&date_to_unix($1) or
return "Invalid date format: '$1'");
push (@search_gt_fields, $i); $in{"$column-gt"} = $1; $i++; next; }
if ($in{$column} =~ /^\<(.+)$/) { ($db_sort{$column} eq 'date') and (&date_to_unix($1) or
return "Invalid date format: '$1'");
push (@search_lt_fields, $i); $in{"$column-lt"} = $1; $i++; next; }
if ($in{$column} !~ /^\s*$/) { ($db_sort{$column} eq 'date') and (&date_to_unix($in{$column}) or
return "Invalid date format: '$in{$column}'");
push(@search_fields, $i); $i++; next; }
if ($in{"$column-gt"} !~ /^\s*$/) { ($db_sort{$column} eq 'date') and (&date_to_unix($in{"$column-gt"}) or
return "Invalid date format: '$in{$column}'");
push(@search_gt_fields, $i); }
if ($in{"$column-lt"} !~ /^\s*$/) { ($db_sort{$column} eq 'date') and (&date_to_unix($in{"$column-lt"}) or
return "Invalid date format: '$in{$column}'");
push(@search_lt_fields, $i); }
$i++;
}
}
# If we don't have anything to search on, let's complain.
in my cgi and something happens
I mean what is displayed with the link
http://www.epocboulevard.com/...mp;view_records.y=13 is the last records sorted by name, ie the records that begin with x, y, z.
I'd like to do the same but with the ID or the date, to have the lats added records.
It's always the last names (alphabetically) that appear.
???
Serge
[This message has been edited by Seth (edited November 08, 1999).]
[This message has been edited by Seth (edited November 08, 1999).]
[This message has been edited by Seth (edited November 08, 1999).]
[This message has been edited by Seth (edited November 08, 1999).]
[This message has been edited by Seth (edited November 08, 1999).]
[This message has been edited by Seth (edited November 08, 1999).]
[This message has been edited by Seth (edited November 08, 1999).]