Gossamer Forum
Home : Products : Links 2.0 : Customization :

Update links.db

Quote Reply
Update links.db
Hi,

I am trying to update my links.db. I used the script by cisco:



I am getting a fatal error:

CGI ERROR
==========================================
Error Message : fatal error: Sort subroutine didn't return a numeric value at /home/cosmetics/cgi-bin/links/admin/nph-build.cgi line 502.


Here is line 502:


# Sort the popular list, and set the cutoff mark.
@popular = sort { $b <=> $a } @popular;


What am I doing wrong?

Please help.

Thanks Madonna

Quote Reply
Re: Update links.db In reply to
You also need to RENUMBER all the IMPORTANT variables in your links.def file when adding fields!

Please refer to the MANY Threads about ADDING fields to the definition and database files.

Regards,

Eliot Lee
Quote Reply
Re: Update links.db In reply to
Thank you Eliot for taking the time to answer my post.

I am adding editor's pick to an existing database.

I followed all the instructions for editor's pick (which included links.def).

I then uploaded all the new files. Uploaded the upgrade.cgi to the data file. It produced a links2.db but I still received the fatal error.

I am a little confused as to the top of the upgrade.cgi. I place 19 because that is new field number. Maybe my error is there.

Thank you again.

Madonna Smile

Quote Reply
IMPORTANT FIELDS In reply to
Eliot, please tell me what is wrong with the important fields?

# Field Number of some important fields. The number is from %db_def above
# where the first field equals 0.
$db_category = 4; $db_modified = 3; $db_url = 2;
$db_hits = 8; $db_isnew = 9; $db_ispop = 10;
$db_contact_name = 6; $db_contact_email = 7; $db_title = 1;
$db_votes = 12; $db_rating = 11; $db_mail = 13;
$db_dateadded = 14; $db_priority = 18; $db_ispick = 19;

Madonna
Quote Reply
Re: Update links.db In reply to
You totally missed my point.

It has nothing to do with the new fields you added or the update you made to the links.db file.

The PROBLEM is that you probably have NOT re-numbered the IMPORTANT field numbers,

like $db_ispick = 19;

LOOK at the IMPORTANT field section BELOW the %db_def hash. The problem with the BUILD script is that is looking at a NON-NUMER field now and thus, the error message.

Got it?

Regards,

Eliot Lee
Quote Reply
Re: Update links.db In reply to
Eliot,

What is it exactly I have to renumber? Can you show me an example?

Please.

Madonna
Quote Reply
Re: Update links.db In reply to
*sigh*

Did you even open the links.def file and look for Important????

Anyway...here is the section I am referring to>>>>>>

In Reply To:

# Field Number of some important fields. The number is from %db_def above
# where the first field equals 0.
$db_category = 4; $db_modified = 3; $db_url = 2;
$db_hits = 8; $db_isnew = 9; $db_ispop = 10;
$db_contact_name = 6; $db_contact_email = 7; $db_title = 1;
$db_votes = 12; $db_rating = 11; $db_mail = 13;


Those fields need to be re-numbered based on the field numbers in the %db_def....

Pretty straightforward...if you ask me...

Good luck!

Regards,

Eliot Lee
Quote Reply
Re: Update links.db In reply to
Eliot,

Yes....I did look for the IMPORTANT Fields and posted them above.

Also, I am hoping you can answer this question and I am not sure how it is working now.

I wanted to add Editor's Pick to an existing database. After reading through the thread and making all the adjustments to the code I then proceeded to upload the new files. It was my understanding that the links.db had to be upgraded since I was adding a new field. So, I did just that and received that fatal error. I replaced my old links.db and now it works.

Thanks for being patient with me.

You are still the best.

Thanks so much.

Madonna SmileSmileSmile

Quote Reply
Re: Update links.db In reply to
Please POST Y O U R IMPORTANT field section! I betcha that you did NOT re-configure the variables CORRECTLY!

Regards,

Eliot Lee
Quote Reply
Re: Update links.db In reply to
Hi Eliot,

Here is what I have:

# Field Number of some important fields. The number is from %db_def above
# where the first field equals 0.
$db_category = 4; $db_modified = 3; $db_url = 2;
$db_hits = 8; $db_isnew = 9; $db_ispop = 10;
$db_contact_name = 6; $db_contact_email = 7; $db_title = 1;
$db_votes = 12; $db_rating = 11; $db_mail = 13;
$db_dateadded = 14; $db_priority = 18; $db_ispick = 19;

Are they re-configured correctly?

Also, I changed the top of the upgrade.cgi script to:

$field_default = ""; #Put the default value of the new field here. Leave Blank for no default.
$new_field = "20"; #Put the new field number here.
$total_fields = "20"; #Put the last field number here.
#Change these value to match your settings
require "../db_utils.pl";
require "../links.def";
#You shouldn't have to edit below this line

I did not receive any errors this time. I just want to make sure that I did everything correct to avoid future problems.

Thank you.

Madonna

Quote Reply
Re: Update links.db In reply to
Hi......need some help.

On the upgrade.cgi I am unsure of:

$field_default = ""; #Put the default value of the new field here. Leave Blank for no default.
$new_field = "20"; #Put the new field number here.
$total_fields = "20"; #Put the last field number here.

I used 20 since that is where I want the new field but I am unsure of $field_default. I am trying to add editor's pick.

Thanking anyone who helps me out.

Madonna