Gossamer Forum
Home : Products : DBMan : Customization :

DBman won't show entries in 2002!

Quote Reply
DBman won't show entries in 2002!
DBman won't show anything newer than 12/31/01. There have been 14 new entries as of 2002, and it won't show any of them when searching by date, searching by date range, or using the "What's New" mod that is available on this site.

I have the "universal date translator" mod applied to my copy of DBman which was written by JPDeni.

Please help!
Quote Reply
Re: [jadey] DBman won't show entries in 2002! In reply to
Is the full year being entered into the database?

I'm pretty sure I have read where others had problems with using a partial year entered.

There is a mod to display partial dates within records.





Unoffical DBMan FAQ

http://creativecomputingweb.com/dbman/index.shtml/
Quote Reply
Re: [LoisC] DBman won't show entries in 2002! In reply to
Yes, the date is being posted in the database like this:
01/03/2002

it is the last field in the database. Could you please help me quickly with this? It is urgent. I'm sure the company who runs the site would pay for your assistance.
Quote Reply
Re: [jadey] DBman won't show entries in 2002! In reply to
I just realized that I have the same problem. No records in 2002 are showing up. Could it be a bug somewhere? My dates are also showing as 4 digits... 18-Dec-2001 and I dont have the Universal Date Mod installed so that cant be the problem. I'll be watching the thread too in case someone else knows.
Quote Reply
Re: [wdu2002] DBman won't show entries in 2002! In reply to
I have put these links in, while this problem is happening, so people can still see new entries. In html.pl:

print qq!| <A HREF="$db_script_link_url&view_records=1&Date=01/03/2002">Show inquiries sent today</a> ! if ($per_view);

print qq!| <A HREF="$db_script_link_url&view_records=1&Date=2002">Show inquiries sent in 2002</a> ! if ($per_view);

The first link would have to be changed daily, unless you used get_date somehow.

Problem is that all my "last 7 days", "last 60 days" etc. links won't show the 2002 entries, so this solution isn't complete - just a temporary one.

Last edited by:

jadey: Jan 3, 2002, 11:50 AM
Quote Reply
Re: [jadey] DBman won't show entries in 2002! In reply to
I still don't have a solution for this problem. I can't believe nobody has stepped up when pay was offered to fix it. Will someone help me for free then? Angelic
Quote Reply
Re: [jadey] DBman won't show entries in 2002! In reply to
I have no idea why it wouldn't be displaying the dates for 2002. I've never seen anyone else have a problem with dates showing up within the fields correctly, but then not displaying in searches, etc.

It doesn't make sense that they would appear correctly in the record itself and then not display in searches, etc.


Unoffical DBMan FAQ

http://creativecomputingweb.com/dbman/index.shtml/
Quote Reply
Re: [LoisC] DBman won't show entries in 2002! In reply to
I'm in complete agreement. It doesn't make sense. However, that's what's happening. wdu2002 in this thread is having the same problem, so I"m not the only one.

Here's some code that I use to call by date:

I use the Universal Date Translation Mod.

Here's my get_date and date_to_unix subroutines:

-------------------------------------------------
sub get_date {
# --------------------------------------------------------
# Returns the date in the format ''dd/mm/yyyy''.
my ($time1) = $_[0];
($time1) or ($time1 = time());
my ($sec, $min, $hour, $day, $mon, $year, $dweek, $dyear, $daylight) = localtime($time1);
($day < 10) and ($day = "0$day");
++$mon;
($mon < 10) and ($mon = "0$mon");
$year = $year + 1900;

return "$mon/$day/$year";
}

sub date_to_unix {
# --------------------------------------------------------
# This routine must take your date format and return the time a la UNIX time().
# Some things to be careful about..
# int your values just in case to remove spaces, etc.
# catch the fatal error timelocal will generate if you have a bad date..
# don't forget that the month is indexed from 0!
#
my ($date) = $_[0];
my ($time);
my ($mon, $day, $year) = split(/\//, $_[0]);
unless ($mon and $day and $year) { return undef; }
use Time::Local;
eval {
$day = int($day); $year = int($year) - 1900;
$mon = int($mon) - 1;
$time = timelocal(0,0,0,$mon,$day,$year);
};
if ($@) { return undef; } # Could return 0 if you want.
return ($time);
}
-------------------------------------------------

In html.pl I search by date like this: (This worked in 2001, no modifications made in this code since)

-------------------------------------------------
<p><b>Search a date range:</b>
<br>Show me inquiries that were received in the last:
|; $time1 = time();
$day1 = &get_date($time1 - (86400 *2));
$day2 = &get_date($time1 - (86400 *3));
$day3 = &get_date($time1 - (86400 *4));
$day4 = &get_date($time1 - (86400 *5));
$day5 = &get_date($time1 - (86400 *6));
$day6 = &get_date($time1 - (86400 *7));
$week1 = &get_date($time1 - (86400 * 8));
$week2 = &get_date($time1 - (86400 * 15));
$month1 = &get_date($time1 - (86400 * 31));
$year1 = &get_date($time1 - (86400 * 350));

print qq|<select name="Date-gt">
<option value="---" selected>Any Date
<option value="$day1"> today
<option value="$day2"> yesterday and today
<option value="$day3"> 3 days
<option value="$day4"> 4 days
<option value="$day5"> 5 days
<option value="$day6"> 6 days
<option value="$week1"> 1 week
<option value="$week2" selected> 2 weeks
<option value="$month1"> 1 month
<option value="$year1"> 1 year
</select>
-------------------------------------------------

Any ideas what the problem could be from this?

Thanks to folks for any help in advance!
Quote Reply
Re: [jadey] DBman won't show entries in 2002! In reply to
In a desperate attempt to get date range searches working, I set up another default DBMan database from scratch to see where things start to go wrong. It happens after I apply the, "Change date format to 22/09/1999" MOD here worked out by JPDeni here:

http://www.gossamer-threads.com/...22%2F09%2F1999;#5410

All my dates in my old database are in mm/dd/yyyy format. Here's a sample:

2411|Paul Waechter|46 mcallister dr|Bloomingdale|On|n0b 2b0|Canada|omnitted@nowhere.ca|Fishing Map|No|Fishing|Hotel/Motel|Drive-In|april|3 days|7||Another-Site|Website|02/11/2002

To search, I have both used both the What's New MOD by JPDeni like this:

# last 7 days

if($in{'listnew'}) {
$days = 8; # Number of days for What's New, +1.
$new = &get_date(time() - ($days * 86400));

# Change Date below to match the *exact* name of your date field.
$in{'Date-gt'} = $new;

# Change 2 below to match the number of your date field.
$in{'sb'} = 19; # Number of your date field

$in{'so'} = 'descend';
}

and a date range search field like this:

Dates after <input type="text" size="10" name="Date-gt">
but before <input type="text" size="10" name="Date-lt">

Here's what happens. The What's New MOD brings up ALL entries in 2001. None in 2002, let alone the last 7 days.

The Date Range search works like this: I can search a date range in 2001 like 11/1/2001 to 12/15/2001 and it works. But any date range within 2002 or that ranges from 2001 to 2002 like 12/18/2001 to 2/7/2002 won't work. I get only the results from 2001. In the URL that gets returned with that, this is the date part:

Date-gt=12%2F18%2F2001&Date-lt=2%2F7%2F2002

So, it is searching the correct range, but doesn't display any results of 2002 records.

Note that I don't have the universal date translator on database. Do you need me to post more code? Please help me out!
Quote Reply
Re: [jadey] DBman won't show entries in 2002! In reply to
One error I spotted:

In sub date_to_unix, the line

$time = timelocal(0,0,0,$mon,$day,$year);

should be:

$time = timelocal(0,0,0,$day,$mon,$year);

I'm not sure whether this is the cause of your problem, though.


kellner
Quote Reply
Re: [kellner] DBman won't show entries in 2002! In reply to
Thanks for the quick reply & excellent suggestion. It didn't fix my problem searching for dates in 2002, but it did change one interesting thing.

Because of this error, I had hard coded a link like this in html.pl:

print qq!| <A HREF="$db_script_link_url&Date=$date&view_records=1">Show inquiries sent today</a> ! if ($per_view);

After your change, it made the link on the page to:

db.cgi?db=default&Date=12/31/1969&view_records=1

There's that default 1969 unix date. What could this point the problem to?

I should note that I also tried fixing this part of the sub date_to_unix:

unless ($day and $mon and $year) { return undef; }

(so that $day ir before $mon).

Oh! Also, it seems as though another person here:
has had problems with the What's New and MM/DD/YYYY MODs working together.

Last edited by:

jadey: Feb 11, 2002, 1:38 PM
Quote Reply
Re: [jadey] DBman won't show entries in 2002! In reply to
After reading several posts on the thread, many of them years old, it seems to me this is indeed a problem with the MM/DD/YYYY format and the, "What's New" MOD working together.

However, my brain isn't perl'd enough to figure out what I've done wrong.

If someone with more perl knowledge could PLEASE help, I would appreciate it very much. I've made the necessary files available here:

http://www.heartland.on.ca/dbfiles/

and you can access the script here: http://www.heartland.on.ca/cgi-bin/inquiries/db.cgi

with the u/p as: please/help
Quote Reply
Re: [jadey] DBman won't show entries in 2002! In reply to
Jadey,

you need to fix *only* the line in date_to_unix which I said was wrong. All the others were fine.

In this line, $day has to be before $month, because you're calling the function "timelocal" which expects things to be that way.

In the line starting with "unless ($day and $month $and year)", the sequence doesn' matter.

What do you mean with that "default unix 1969" date? I don't understand this.

Try changing all your calls to &get_date(); to &get_date(time());

There's no other thing I can think of. The main thing the what's new mod introduces is that, unlike in the old versions of get_date, get_date now works with an input value that is passed to it. It may choke if you don't.

Note that get_computed_date still has the old date format. Not sure what you use it for, but maybe this is important.

Last straw: is the "Date" field defined as "date" in the cfg-file?
kellner
Quote Reply
Re: [kellner] DBman won't show entries in 2002! In reply to
Thanks so much again, kellner, for your excellent suggestions. Smile

I still can't do a date range search. Unsure

Here are the changes I've made. I found all instances of &get_date(); and changed them to: &get_date(time()); I even did this in default.cfg so my Date field is:

'Date' => [19, 'alpha', 20, 255, 0, &get_date(time()), '']

(so yes it is Date, not date). One fix of the get_date did get rid of that 1969 date for today.

I changed get_computed_date to:
------------------------------
my ($time) = $_[0];

$year = substr($time,0,4);
$mon = substr($time,4,2);
$day = substr($time,6,2);

unless ($mon && $day && $year) {
return undef;
}
--$mon;
my (@months) = qw!01 02 03 04 05 06 07 08 09 10 11 12!;

return "$mon/$day/$year";
}
------------------------------

My What's New mod in db.cgi looks like this:
------------------------------
if($in{'listnew'}) {
$days = 8; # Number of days for What's New, +1.
$new = &get_date(time() - ($days * 86400));

# Change Date below to match the *exact* name of your date field.
$in{'Date-gt'} = $new;

# Change 2 below to match the number of your date field.
$in{'sb'} = 19; # Number of your date field

$in{'so'} = 'descend';
}
------------------------------

and the link to that in html.pl is like this:

print qq!| <a href="$db_script_link_url&listnew=1&view_records=1">Show last 7 Days</a> ! if ($per_view);

That link will still show all records from 2001, not just the last 7 days, and none in 2002.

My date range search box code is still the same, and still broken. Pirate
Quote Reply
Re: [jadey] DBman won't show entries in 2002! In reply to
In the line

'Date' => [19, 'alpha', 20, 255, 0, &get_date(time()), '']



change 'alpha' to 'date'. That's needed for sorting dates, and this may be the reason why you can't sort on dates.
kellner
Quote Reply
Re: [kellner] DBman won't show entries in 2002! In reply to
Oh my gosh THANK YOU! What a simple error. Blush I owe you tons for pointing it out. Tell me whatcha need. I'll spread the word that kellner rules.
Quote Reply
Re: [jadey] DBman won't show entries in 2002! In reply to
Glad I could help. If I keep going like this, I'll end up with world domination in no time. Wink
kellner
Post deleted by jadey In reply to

Last edited by:

jadey: Feb 13, 2002, 9:58 AM