Gossamer Forum
Home : Products : DBMan : Installation :

Look for existing record then...

Quote Reply
Look for existing record then...
Hello,
I am having a problem with the DBMan, and I wonder where the problem is. What I would like to do is have people login to the database, if they have not set up a "homepage" for themselves, they will be prompted to fill out the required information. If they have done that, they will be sent to their homepage immediately.
What I have done, is under html_home added this code:
&get_record($in{$db_key});
if ($rec{'Userid'} != 0) {
&html_record(&get_record($in{$db_key}))
} else {
&html_print_headers;
print qq!
<html>
<head>... It then goes on to print off a form that users fill out to add themselves.
The problem is that the form to add themselves keeps showing up, despite the fact that I have added a record. I am using the Userid field as the key so that people cannot have two pages under the same username.
If you can help me out, I'd really appreciate it.
Thanks in advance.
Mike


------------------
Quote Reply
Re: Look for existing record then... In reply to
Hi Mike,

Quote:
&get_record($in{$db_key});
if ($rec{'Userid'} != 0) {
&html_record(&get_record($in{$db_key}))
} else {
&html_print_headers;

Problem is you call get_record, but do not save the results! Try:

my %rec = &get_record ($in{$db_key});
if ($rec{'Userid'}) {
# Record exists!
}
else {
# Record doesn't exist!
}

Hope that helps,

Alex