Gossamer Forum
Home : Products : DBMan : Customization :

CGI ERROR

Quote Reply
CGI ERROR
Error Message : fatal error: Not a CODE reference in sort at db.cgi line 619.

Script Location : db.cgi
Perl Version : 5.00503
Setup File : user.cfg
User ID : default
Session ID : default


Not sure what this means.
I goto LIST ALL USERS and I get this on my last newly created USER.

Any ideas?

Quote Reply
Re: CGI ERROR In reply to
What is the line of code you are using for your LIST ALL?


Unoffical DBMan FAQ
http://webmagic.hypermart.net/dbman/
Quote Reply
Re: CGI ERROR In reply to
print qq!| <A HREF="$db_script_url?db=user&uid=$db_uid&view_records=1&UserID=*">List All Users</A> |<BR>! if ($per_view);


Quote Reply
Re: CGI ERROR In reply to
I'm not really sure why you would be getting the error?
Do you have debugging on and does it provide any additional error messages?

This must be a relational database, yes? I ask cause you are using: $db_script_url rather than $db_script_link_url

Try this and see if it works:

print qq!| <A HREF="$db_script_url?db=user&uid=default&view_records=1&$db_key=*">List All Users</A> ! if ($per_view);

Also I would highly suggest visiting the FAQ noted below and getting the Debugging - How To Obtain Useful Error Messages which is listed under "Troubleshooting" it has saved me hours of being able to quickly identify where I had errors when installing mods, etc.

Sorry I could not be of more help, I've never seen this before myself.


Unoffical DBMan FAQ
http://webmagic.hypermart.net/dbman/
Quote Reply
Re: CGI ERROR In reply to
Good morning LoisC.
Okay, the good news is, it seems the errors have gone away for now. I wish I could remember what happened.

Now, basically what is happening is an issue. If you login and use the List All Users (I did change it to db_key=*) it pulls up a short list of users. At that point you can click on one and then proceed using next and previous. However, when you get to a record with more than one record in the item.db, it shows the first NAME correct (PROPID is my db_key and should display for all records) however after the first record, the TEXT of the name is replaced with another field name that is not PROPID field, it is a CHECKBOX field.
IE:

SHACK (correct name - record 1 for user 1 "info pulled from PROPID)
BEACH (correct name - record 2 for user 1 "info pulled from PROPID)
POOL (incorrect name - record 3 for user 1 "still links howing PROPID but it is another field)

My guess I have an issue with the sort routine somewhere.
PS...I removed the List All Users and Search by users if you are a default user......that way they wont see the problem, however if you login, you will certainly see it.


Thanks
Theri



Quote Reply
Re: CGI ERROR In reply to
I would first check to be sure the database is not corrupted and that all the field entries are in the correct location within the database.

You are using the relational mod?

Was this all working correctly and then stopped after you added something new?

Unoffical DBMan FAQ
http://webmagic.hypermart.net/dbman/
Quote Reply
Re: CGI ERROR In reply to
Hi Lois.....

I'm positive the fields are correct......

The default relational mod worked fine and then I had a couple of issues that are working now.

The only issue at hand, which I have worked around now, is when you do a List All Users (only available to admin now), any users that have multiple records in items.db (this is the list of items that are shown in short form below the users information screen)as you click through them the user names, my PROPID field names come up as expected. However it is only the first listed that shows the correct ENTRY for PROPID. The following records show entries that are from another field name, not the entries from the PROPID field which they should be.

As I mentioned, the only one that will see it now is me....however it is unacceptable :-) To correct it, the visitor has the option to view all items of a user based on a dynamic link that lists the records in the short mod and they show up fine. It's just when you view users, the item records show up screwy.....

Go figure.


Quote Reply
Re: CGI ERROR In reply to
It would be sooo much easier to try and help you if you posted the portion of your coding where you are having problems. It takes alot of guesswork out of trying to figure out what is wrong, and it might make it easy to spot something that may be wrong.

Without seeing the coding or having access to your files, it's difficult to be able to help.

Does your coding to where you are pulling up the information look very similiar to this (other than actual field names)?


&switch_to_jobs;
undef %in; #### see thread 2478 4/10/2000
$in{'UserID'} = $rec{'UserID'};
$in{'mh'} = 100;
my ($status2,@hits2) = &query("view");
if ($status2 eq "ok") {
my ($numhits2) = ($#hits2+1) / ($#db_cols+1);

for (0 .. $numhits2 - 1) {
%rec2 = &array_to_hash($_, @hits2);
print qq|<TR><TD><$font><A HREF="$db_script_url?db=jobs&uid=$db_uid&ItemID=$rec2{'ItemID'}&view_records=1">$rec2{'ItemID'}</A> - $rec2{'Category'} - $rec2{'Title'}</font></td></tr> |;
}



Unoffical DBMan FAQ
http://webmagic.hypermart.net/dbman/
Quote Reply
Re: CGI ERROR In reply to
What I have done is published to a public folder so you can view the files at will. I have had inconsistencies posting code here.

http://www.coastcottages.com/dbman
Is where you'll find the files in .txt format.

I found this in my user_html.pl file......is this what code you are requesting?


&switch_to_item;
undef %in;
$in{'UserID'} = $rec{'UserID'};
$in{'sb'} = 6;
$in{'so'} = 'descend';
$in{'mh'} = 100;

my ($status2,@hits2) = &query("view");

if ($status2 eq "ok") {
my ($numhits2) = ($#hits2 1) / ($#db_cols 1);
print qq|<table>|;

for (0 .. $numhits2 - 1) {
%rec2 = &array_to_hash($_, @hits2);
print qq|
<tr><td>
<a href="$db_script_url?db=item&uid=$db_uid&PROPID=$rec2{'PROPID'}&view_records=1">$rec2{'PROPID'}</a>
</td></tr>
|;
}
print qq|</table>|;
}

&switch_to_user;
}
Quote Reply
Re: CGI ERROR In reply to
If you had compared your coding to what I posted from mine, you may have noticed the difference in the following line:

my ($numhits2) = ($#hits2 1) / ($#db_cols 1);

### mine has

my ($numhits2) = ($#hits2+1) / ($#db_cols+1);

Did you make this change and if so, did it make a difference in what is happening?


Unoffical DBMan FAQ
http://webmagic.hypermart.net/dbman/
Quote Reply
Re: CGI ERROR In reply to
http://www.coastcottages.com/cgi-bin/rentals/db.cgi?db=user&uid=default&UserID=MAGS&view_records=1

You wil get a better idea of seeing what it does.

Choose first record. Then click on next and you will see SHACK and Handicap Access. Handicap Access is wrong and should show BEACH. Shack and Beach are entries from my PROPID field.


Quote Reply
Re: CGI ERROR In reply to
sub html_record_long {
# --------------------------------------------------------
# How a record will be displayed. This is used primarily in
# returning search results and how it is formatted. The record to
# be displayed will be in the %rec hash.

my (%rec) = @_; # Load any defaults to put in the VALUE field.
($db_auto_generate and print &build_html_record(%rec) and return);

my $font_color = 'Font face="Verdana, Arial, Helvetica" Size=2 Color=#003399';
my $font = 'Font face="Verdana, Arial, Helvetica" Size=2';
$rec{'UserID'} =~ s/<\/?B>//g;
$url{'UserEmail'} = $rec{'UserEmail'};
$url{'UserEmail'} =~ s/<\/?B>//g;
if ($db_total_hits > 1) {

# create links to previous and next records

$next_url = $ENV{'QUERY_STRING'};
$next_url =~ s/\&nh=\d+//;
$next_hit = $nh + 1;
$prev_hit = $nh - 1;

if ($prev_hit) {
$previous = qq~<a href="$db_script_url?$next_url&nh=$prev_hit"><$font>Previous</font></a>~;
}
else { $previous = " "; }

if ($next_hit <= $db_total_hits) {
$next = qq~<a href="$db_script_url?$next_url&nh=$next_hit"><$font>Next</font></a>~;
}
else { $next = " "; }

# create link back to short display
$list_url = $next_url;
$list_url =~ s/\&mh=\d+//;
$mh = $db_max_hits;
$lh = int(($nh-1)/$mh) + 1;
$list = qq~<a href="$db_script_url?$list_url&nh=$lh"><$font>Back to record list</font></a>~;

# print out the links
print qq|
<table width=100%>
<tr><td width=50%>$previous</td>
<td width=50% align=right>$next</td></tr>
<tr><td colspan=2 align=center>$list</td></tr>
<tr><td colspan=2 align=center><$font>Record $nh of $db_total_hits</font></table>
|;
}

print qq|
<TABLE WIDTH="475" CELLPADDING=0 CELLSPACING=0 BORDER=1 BGCOLOR="#FFFFCC">
<TR><TD ALIGN="Right" VALIGN="TOP" WIDTH="20%"><$font_color>UserFirstName:</FONT></TD>
<TD WIDTH="80%"> <$font>$rec{'UserFirstName'}</Font></TD></TR>
<TR><TD ALIGN="Right" VALIGN="TOP" WIDTH="20%"><$font_color>UserLastName:</FONT></TD>
<TD WIDTH="80%"> <$font>$rec{'UserLastName'}</Font></TD></TR>
<TR><TD ALIGN="Right" VALIGN="TOP" WIDTH="20%"><$font_color>UserEmail:</FONT></TD>
<TD WIDTH="80%"> <$font><a href="mailto:$url{'UserEmail'}">$rec{'UserEmail'}</a>
<TR><TD ALIGN="Right" VALIGN="TOP" WIDTH="20%"><$font_color>UserCity:</FONT></TD>
<TD WIDTH="80%"> <$font>$rec{'UserCity'}</Font></TD></TR>|;
if ($rec{'UserState'}) {
print qq|
<TR><TD ALIGN="Right" VALIGN="TOP" WIDTH="20%"><$font_color>UserState:</FONT></TD>
<TD WIDTH="80%"> <$font>$rec{'UserState'}</Font></TD></TR>
|;
}
print qq|
<TR><TD ALIGN="Right" VALIGN="TOP" WIDTH="20%"><$font_color>UserCountry:</FONT></TD>
<TD WIDTH="80%"> <$font>$rec{'UserCountry'}</Font></TD></TR>
<TR><TD ALIGN="Right" VALIGN="TOP" WIDTH="20%"><$font_color>CompanyName:</FONT></TD>
<TD WIDTH="80%"> <$font>$rec{'CompanyName'}</FONT></TD></TR>
<TR><TD ALIGN="Right" VALIGN="TOP" WIDTH="20%"><$font_color>CompanyAddress:</FONT></TD>
<TD WIDTH="80%"> <$font>$rec{'CompanyAddress'}</FONT></TD></TR>

</TABLE>
|;
&switch_to_item;
undef %in;
$in{'UserID'} = $rec{'UserID'};
$in{'sb'} = 6;
$in{'so'} = 'descend';
$in{'mh'} = 100;

my ($status2,@hits2) = &query("view");

if ($status2 eq "ok") {
my ($numhits2) = ($#hits2+1) / ($#db_cols+1);
print qq|<table>|;

for (0 .. $numhits2 - 1) {
%rec2 = &array_to_hash($_, @hits2);
print qq|
<tr><td>
<a href="$db_script_url?db=item&uid=$db_uid&PROPID=$rec2{'PROPID'}&view_records=1">$rec2{'PROPERTYNAME'}</a> $rec2{'CITY'} $rec2{'STATE'}
</td></tr>
|;
}
print qq|</table>|;
}

&switch_to_user;
}


This is routine in user_html.pl