Gossamer Forum
Home : Products : DBMan : Discussions :

Getting Data out of the database

Quote Reply
Getting Data out of the database
Hi,
I have a field, which will be static for the users, and they can not change it, so I have made it invisible, but how do I get the value out of the databse? I looked at the Validate Record mod on jpdeni and thought it would be like the $db_email_field.
So I created $db_user_field = 'value';
However when I recieve the e-mails the record is left blank! How come it is not getting that information?
Regards
Ben

Quote Reply
Re: GEtting Data out of the database In reply to
Change the field to admin only rather than invisible.

That way you as admin can receive the value by email, but it will not be displayed to anyone but admin for the record display.

Unoffical DBMan FAQ
http://webmagic.hypermart.net/dbman/
Quote Reply
Re: GEtting Data out of the database In reply to
Hello Lois:
Are you aware that: http://webmagic.hypermart.net/dbman/ is not functional at present?

Quote Reply
Re: GEtting Data out of the database In reply to
It works for me.

Regards,

Eliot Lee
Quote Reply
Re: GEtting Data out of the database In reply to
Webmagic's url didn't work from here.

ERROR: The requested URL could not be retrieved
-----------------------------------------------------
While trying to retrieve the URL: http://webmagic.hypermart.net/dbman/

The following error was encountered:

ERROR 205 -- DNS name lookup failure. Please contact your system administrator.


Quote Reply
Re: GEtting Data out of the database In reply to
I think there was a problem with hypermart server during the time. I know that cos' I'm also using hypermart to host the scripts and for one day, it also gave the same error message. It was resolved a day later.

Julian
Quote Reply
Re: GEtting Data out of the database In reply to
vampy:

Yes you are right the Hypermart server was having problems for a day. The FAQ is back up and running again.





Unoffical DBMan FAQ
http://webmagic.hypermart.net/dbman/
Quote Reply
Re: GEtting Data out of the database In reply to
I searched the forum and managed to find this: -

sub build_select_field_from_db {
# --------------------------------------------------------
# Builds a SELECT field from the database.
my ($column, $value) = @_;
my (@fields, $field, @selectfields, @lines, $line, $output);
$db_file_name = 'default.db';
$fieldnum = 8;
open (DB, "<$db_file_name") or &cgierr("unable to open $db_file_name. Reason: $!");
if ($db_use_flock) { flock(DB, 1); }
LINE: while (<DB> ) {
next if /^#/;
next if /^\s*$/;
$line = $_;
chomp ($line);
@fields = &split_decode ($line);
if (!(grep $_ eq $fields[$fieldnum], @selectfields)) {
push (@selectfields, $fields[$fieldnum]);
}
}
close DB;

$output = qq|<SELECT NAME="$column"><OPTION>---|;
foreach $field (sort @selectfields) {
($field eq $value) ?
($output .= "<OPTION SELECTED>$field") :
($output .= "<OPTION>$field");
}
$output .= "</SELECT>";
return $output;
}

However it builds a select field! How do I modify it so its just a text field? I still want it to get its value from the 8th field in the database.
Regards
Ben