Gossamer Forum
Home : Products : DBMan : Installation :

weirdness with -gt date related queries

Quote Reply
weirdness with -gt date related queries
JPDeni /Alex

The date related searches I have implemented by making the changes recommended by JPDeni in a prior topic work fine;

To recap, the fixes were :
in db.cgi, change the get_date subroutine as follows:
"The previous code I gave you for finding dates works just fine.
The problem is that get_date needs to be changed.

The changes are in bold print:
code:
(the first 2 lines were changes, and the localtime on the 3rd line was as well)
my($time) = $_[0];
unless ($time) { $time = time(); }
my ($sec, $min, $hour, $day, $mon, $year, $dweek, $dyear, $daylight) =localtime($time);
my (@months) = qw!Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec!;
($day < 10) and ($day = "0$day");
$year = $year + 1900;

return "$day-$months[$mon]-$year";
---------------------------------------

OK, having said and quoted all that, this works fine AS LONG AS, the user actually logs in to DBMAN. If they try to use a date related query from a default user link, then the search comes up with an invalid date format message with a date of Dec 1969 (the old UNIX I don't have a valid date so therefore this is the date type message)

Now, I think I need to update the date_to_unix subroutine to fix this, however, I'm not sure what to fix.

Any help appreciated.

(man, one of these days I'm going to understand all this and then I'm REALLY going to be scared!!!!)
;-)

TIA

Jamie


------------------
James A. (Jamie) Dennis
*Certified AIX Administrator
*Certified Solaris Administrator
*Member - SAGE, USENIX
Quote Reply
Re: weirdness with -gt date related queries In reply to
Jamie, I just went to your site as a default user and, in your "last 10 days" search it had (in part):

&view_records=1&Date-gt=04-Feb-1999

That was on the database home page. But it didn't work when I tried it on one of the search results pages. Do you have the "last 15 days" link in a footer? I think your code in the footer is having a problem. For some reason it's not getting today's date to subtract from.





------------------
JPD
Quote Reply
Re: weirdness with -gt date related queries In reply to
JPD,

Yes, the code is in the sub html_Footer .

Here is the actual code chunk from alumni.pl


# Code for searching for new registrants
$days = 15;
$new = &get_date(&date_to_unix(&get_date) - ($days * 86400));

print qq!<TD><a href="$db_script_link_url&view_records=1&Date-gt=$new&so=descend&sb=6"><$font>New Records (last 15 days)</font></a></TD>!;

Quote Reply
Re: weirdness with -gt date related queries In reply to
What I'm finding odd is that it works on the main menu page, but not on the search results page. (At least that's what happened when I went there just now.) Do you have the entire code within the html_footer_subroutine? You need to define your $new variable within the same subroutine as you print out the link. If you do have it there, I don't know what could be wrong.

Oh, I found a little bit nicer way to make the script.

$new = &get_date(time() - ($days * 86400));

Does exactly the same thing.


------------------
JPD
Quote Reply
Re: weirdness with -gt date related queries In reply to
Yes, it is all in the footer. It is equally puzzling to me. I've never since the same code work differently like this when called from the same link. The only difference appears to be that when logged in it works, and when coming from a default link it doesn't.

Quote Reply
Re: weirdness with -gt date related queries In reply to
The only thing I can suggest is making your html.pl file available on the web so I can take a look at it.


------------------
JPD