Gossamer Forum
Home : Products : DBMan : Customization :

Adding a new field and showing it with record

Quote Reply
Adding a new field and showing it with record
Problem 1
I need to add another field to the database. How can I do that after its already finished and running.

Problem 2

The field I need is a link with a code for registering software for the palmpilot Dont know what the link or code is yet but it will look like this

http://www.registerhere.com/register.cgi?ID=123456

Not all programs will have a link and when they do I would like the url to be in the script and the record 123456 would be pulled from the database. each 123456 will be a different number.

What Im tring to say is I need a link from each record to go too another site for registering the program and each program will have a different code the url and cgi? will be the same.

I hope that was clear I confused myself :>

Mitch




[This message has been edited by Mitch C (edited April 13, 2000).]
Quote Reply
Re: Adding a new field and showing it with record In reply to
1) Use the add fields to your existing database mod in the Resource Center.

2) Simply add the following codes to your sub html_record routine in the html.pl file:

Code:
<a href="http://www.registerhere.com/register.cgi?ID=$rec{'ID'}">Register It!</a>

Regards,

------------------
Eliot Lee....
Former Handle: Eliot
* Check Resource Center
* Search Forums
* Thinking out of the box (codes) is not only fun, but effective.
Quote Reply
Re: Adding a new field and showing it with record In reply to
Great. Your the best.

Thanks

Mitch
Quote Reply
Re: Adding a new field and showing it with record In reply to
getting a script produced no out put error

heres the config part

Code:
###############################################################
# Configuration Section
###############################################################

#Put the default value of the new field here. Leave Blank for no default.
$field_default = "";

#Put the new field number here.
$new_field = "9";

#Put the last field number here.
$total_fields = "10";

# Database path...same as in db.cgi file

$db_script_path = 'd:/inetpub/palmfilez/cgi-bin';

#Change these value to match your settings
#You may have to use the absolute path to your .cfg and .cgi file

require "d:/inetpub/palmfilez/cgi-bin/default.cfg";

#Rename database file
#You may have to use the absolute path to your second database file

$db_file_name2 = "d:/inetpub/palmfilez/cgi-bin/default2.db";

Heres default.cfg

Code:
%db_def = (
'ID' => [ 0, 'numer', 5, 8, 1, '', ''],
'Catagory' => [ 1, 'alpha', 0, 22, 1, '-SELECT-', ''],
'Program Name' => [ 2, 'alpha', 20, 255, 1, '', ''],
'Program Download URL'=> [ 3, 'alpha', 20, 255, 1, 'http://', '^http://'],
'Program Tech Support'=> [ 4, 'alpha', 20, 255, 0, 'http://', '^http://'],
'Program Description' => [ 5, 'alpha', '40x5', 500, 1, '', ''],
'Date added' => [ 6, 'date', 20, 255, 1, &get_date(), ''],
'E-Mail' => [ 7, 'alpha', 20, 255, 1, '', '.+@.+..+'],
'Userid' => [ 8, 'alpha', -2, 15, 0, '', ''],
'RegCode' => [ 9, 'alpha', 20, 255, 0, '', '']
);


Mitch



[This message has been edited by Mitch C (edited April 13, 2000).]
Quote Reply
Re: Adding a new field and showing it with record In reply to
This is wrong:

Code:
#Put the last field number here.
$total_fields = "10";

Your last field number is 9.

And you have to put the correct Perl Path in the first line of the file as you would for any other .cgi script.

Regards,

------------------
Eliot Lee....
Former Handle: Eliot
* Check Resource Center
* Search Forums
* Thinking out of the box (codes) is not only fun, but effective.
Quote Reply
Re: Adding a new field and showing it with record In reply to
I just tried it same problem.

My config and upgrade files are listed for review. As far as the perl path Im on windows NT 2000.

http://www.palmfilez.com/default.txt
http://www.palmfilez.com/upgrade.txt

Mitch

Quote Reply
Re: Adding a new field and showing it with record In reply to
Anyone with any ideas I tried everything?

Mitch
Quote Reply
Re: Adding a new field and showing it with record In reply to
As I mentioned before...you have the WRONG values for the following variable!

Code:
#Put the last field number here.
$total_fields = "10";

This is NOT hte total number of fields, but the last field number WHICH is 9!

Change this variable to the following:

Code:
$total_fields = "9";

Good luck!

Regards,

------------------
Eliot Lee....
Former Handle: Eliot
* Check Resource Center
* Search Forums
* Thinking out of the box (codes) is not only fun, but effective.
Quote Reply
Re: Adding a new field and showing it with record In reply to
I posted the wrong default.txt the correct one is up now. I retried anyway and got this error again
'd:\inetpub\palmfilez\cgi-bin\upgrade.cgi' script produced no output


Mitch
Quote Reply
Re: Adding a new field and showing it with record In reply to
Well, for one thing...the Perl path is INCORRECT for NT. Change it to whatever path you use in your other .cgi scripts (that work).

That is the other problem I see in your script.

BTW: This script was originally tested and written for NT, so, it should work.

Wink

Regards,



------------------
Eliot Lee....
Former Handle: Eliot
* Check Resource Center
* Search Forums
* Thinking out of the box (codes) is not only fun, but effective.
Quote Reply
Re: Adding a new field and showing it with record In reply to
#!/usr/bin/perl

Is what I have in all my scripts

Is it true that NT doesnt use the perl path thats controlled by the .pl and .cgi extention? I might be wrong I pick that up from reading the posts here

Mitch
Quote Reply
Re: Adding a new field and showing it with record In reply to
 
Quote:
Is it true that NT doesnt use the perl path thats controlled by the .pl and .cgi extention?

Sort of...And if you are using the recent build of Perl from ActiveState, there are specific paths that you must use...sorry I do not have copies of the NT formatted .cgi scripts. And I have included the correct path for NT in numerous Topics in the Installation Forum and in the other Installation Forums in this site.

Again, the perl path is causing the problem IMHO...because all the settings in the upgrade.cgi script are correct.

Regards,

------------------
Eliot Lee....
Former Handle: Eliot
* Check Resource Center
* Search Forums
* Thinking out of the box (codes) is not only fun, but effective.
Quote Reply
Re: Adding a new field and showing it with record In reply to
I edited by hand need to get this going.

I added that link in sub html_record routine in the html.pl file: and in fact in two spots one for with gfx files and one at with out (upload mod). works great

Code:
GRAPHIC: foreach $extension (@extensions) {
if (-e "$SAVE_DIRECTORY/$rec{$db_key}.$extension") {
print qq|<center><img src= "$SAVE_DIRECTORY_URL/$rec{$db_key}.$extension" width=160 height=160 border=0></center>
<p align="center"><a href="http://www.palmfilez.com/$rec{'RegCode'}" target="_blank"><img border="0" src="http://www.palmfilez.com/images/tiny_button_buyit.gif" width="100" height="36"></a></p>
|; $pic=1;
last GRAPHIC;
}
}
unless ($pic) {
print qq|<center><img src="$SAVE_DIRECTORY_URL/no_gfx.jpg" width=160 height=160 border=0></center>

<p align="center"><a href="http://www.palmfilez.com/$rec{'RegCode'}" target="_blank"><img border="0" src="http://www.palmfilez.com/images/tiny_button_buyit.gif" width="100" height="36"></a></p>|;
}

Now need to be able for me to add the record via the add and edit function for admin access only or the option to let everyone or to let only admin.

my file will be posted here:

http://www.palmfilez.com/default.txt
http://www.palmfilez.com/db.txt
http://www.palmfilez.com/html.txt

Mitch







[This message has been edited by Mitch C (edited April 14, 2000).]