Gossamer Forum
Home : Products : DBMan : Installation :

What's New Problem

Quote Reply
What's New Problem
I have added the What's New and have the days set for the past 3 days-
"$days = 3;"

However, when I choose the link for the What's New I recieve this error -
"There were problems with the search. Reason: no search terms specified
Please fix any errors and submit the record again."

Any Ideas of where I am supposed to specify the terms for the search?

BTW - I noticed in another post about "What's New Problems", that JPDeni states that there is a better way of doing the What's New than what is listed at http://www.drizzle.com/~hall/dbmod/new.html.

Could you maybe post the full update on this rather than in bits and pieces? Or maybe email me the full update on the What's New mod?

Thank you very much !

[This message has been edited by donm (edited April 02, 1999).]
Quote Reply
Re: What's New Problem In reply to
I am still getting the error - "There were problems with the search. Reason: no search terms specified Please fix any errors and submit the record again."

I am not sure I understand - "Make the changes indicated in bold print -- that is, add -gt and -lt where indicated."

Where what is indicated? The other What's New was working until the first of April and then it only would post entries up until the 31st of March. No entries from April are displaying now. I have changed my date field to be "Last Modified".

Here is what I have:

In sub html_home:
$days = 7; #adjust to your preference
$time = time() - ($days * 86400);
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;

$new = "$day-$months[$mon]-$year";


and I have this as the link:

<a href="$db_script_link_url&Date-gt=$new&view_records=1"><$font><B>recently added or updated profiles</B></font></a>

Then in db.cgi in sub query I have:
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: ''");
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: ''");
push(@search_lt_fields, $i); }
$i++;
}
}

Any help will be much appreciated !
Quote Reply
Re: What's New Problem In reply to
 
Quote:
I have changed my date field to be "Last Modified".

Then you would have to change the link.

<a href="$db_script_link_url&Last+Modified-gt=$new&view_records=1">



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





Quote Reply
Re: What's New Problem In reply to
Thanks for your help JPDeni - I apologize for my lack of knowledge.

Ok now records are displaying, however, only through March 31 with $days = 3;

Nothing for April and I know that there were at least 4 records added on April 1, but they are not displaying in the short list?

Quote Reply
Re: What's New Problem In reply to
I don't know that I ever posted that URL. (Maybe I did, but I forgot.) I think some folks did some searching in the directory and picked it up even though it wasn't ready.

I haven't had time to make a new page for it, but here it is again
Code:
$days = 30; #adjust to your preference
$time = time() - ($days * 86400);
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;

$new = "$day-$months[$mon]-$year";

You will also need to fix a bug in db.cgi.

Go to sub query in db.cgi. Scroll down a little until you see:

Code:
else {
$i = 0;
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: ''");
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: ''");
push(@search_lt_fields, $i); }
$i++;
}
}

Make the changes indicated in bold print -- that is, add -gt and -lt where indicated.

use

<a href="$db_script_link_url&Date-gt=$new&view_records=1">New records</a>

for your link to new records.

I have removed the file from my server so no one else will get confused.


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





Quote Reply
Re: What's New Problem In reply to
Could you give me the URL for your database so I can see it?


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





Quote Reply
Re: What's New Problem In reply to
Sure I can ... the url is:
http://www.cocoahighalumni.com/cgi-bin/dbman/db.cgi

I have created an account for you that will allow you to view/add/modify the userID/password is: jpdeni/jpdeni

Thanks again for your help !

BTW - I checked the database and there are 9 records that have been added since April 1st, none of which are displaying when clicking on the What's New link.

[This message has been edited by donm (edited April 02, 1999).]
Quote Reply
Re: What's New Problem In reply to
I'm not sure what's going on. A search for "Last Modified" after 30-Mar-1999 returned 6 records. When I changed it to after 31-Mar-1999, I got no records. But when I changed it to 1-Apr-1999, I got 150 records.

Then I added a record and my browser crashed. When I went back, I did a search for my name and it was there, but it didn't show up in the "new" records. (BTW, there was no "delete" option, so I couldn't delete the record I'd added. You'll need to take out the one for "Carol Hall.")

Then I did a search. I entered a "*" in the ID field and set the sort options to sort by "Last Modified" in descending order. My record should have been close to the top, but it wasn't there at all.

Very odd. But the problem is not with the "What's New" mod. It's something else in your script or in your database.

You say you changed the name of your field. Did you change anything else?

I did notice a couple of things. In your html_record (long display) you need to add a command

&html_print_headers;

at the beginning of the subroutine in order to actually get an html page.

Also, you need a "<P>" or at least a "<BR>" after

if ($db_next_hits) {
print "<br><$font>Pages: $db_next_hits</font>";
}

in html_veiw_success so that your names are on a different line from the "next pages" links.


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





Quote Reply
Re: What's New Problem In reply to
I made the changes you mentioned - the only thing that I changed as far as date is concerned I made a field called "Last Modified" and it uses the "&get_date" - but that is all I know of?

BTW - I did a search of records "Last Modified" with a date of 01-Apr-1999 and all 9 records previously mentioned shows up - it just doesn't work with the What's New.



[This message has been edited by donm (edited April 02, 1999).]
Quote Reply
Re: What's New Problem In reply to
I was going to go back and check it again, but I can't view the records.


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





Quote Reply
Re: What's New Problem In reply to
You can now ! :-) I have updated your permissions jpdeni.
Quote Reply
Re: What's New Problem In reply to
Now it's April 3rd - my days are set to "$days=3;" - now there are no matching records for the "What's New" link (although I have added around 6 new records).

Records were displaying properly before April with the What's New - but since the month has changed to April - What's New has stopped working.
Quote Reply
Re: What's New Problem In reply to
I know that if you do a search (using the search form) for a specific date, you get the results you want. But try using a ">Date" search and you'll get the same results as you get with the "What's New."

Try >01-Apr-1999, >31-Mar-1999 and >30-Mar-1999.

Since none of these work correctly, it isn't a problem with "What's New." It's a problem with searching for "greater than" dates.

Have you made any changes to either sub get_date or sub date_to_unix in db.cgi?


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





Quote Reply
Re: What's New Problem In reply to
No - sorry I haven't made any changes to the "sub get_date or sub date_to_unix" in db.cgi

The only changes I made were the ones mentioned in the new.html ( I think that was the name of it?).

I really like this script - and we are going to use it - I registered it last night. I thought about maybe doing a complete re-install - but I would really have to make alot of changes now. We would really like to have the "What's New" mod. But, maybe I should just remove it? I don't know at this point what would be the best thing to do?
Quote Reply
Re: What's New Problem In reply to
I dreamed of your "What's New" problem last night! Smile And I know what the problem is.

Check in your default.cfg file for the field_type of your "Last Modifified" field. I'll bet that it's 'alpha.' It needs to be 'date.'


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





Quote Reply
Re: What's New Problem In reply to
JPDeni - thank you - thank you - thank you !!! I apologize for interrupting your dreams.

You were right ! It was set to "alpha" instead of "date".

It now works as it should :-)

Quote Reply
Re: What's New Problem In reply to
 Smile No problem. It's one of those things that's easy to miss.

I'm not really even sure what my dream was about, but I woke up thinking "'Apr' is only greater than 'Mar' if you're talking about dates."

I'm just glad we got the mystery solved.


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