Gossamer Forum
Home : Products : DBMan : Customization :

User search

Quote Reply
User search
Hello there,

I have multiple users using DBman, and I'm trying to set up a way for each user to display only their records. I was thinking of adding a link where Add, Delete, Modify, etc... are.

Example: User "joesmith" wants to display all his records only. He would click on "my records" and all the records "joesmith" added would be displayed just like "List All".

The way it's set up now each user has to go to "Search", type in their username, and then all the records are displayed. Is there an easier way to do this?

Thanks a lot,
Dave
Quote Reply
Re: [dhoefler] User search In reply to
Try using this:

Send user to their record directly after logging in

Add the following to the beginning of sub html_home in html.pl:

#### send user to their record after login ########
unless ($per_admin) {
$in{$db_key} = $db_userid;
&view_records;
return;
}
############

This assumes that the userid field is the $db_key field (which would make sense, since it seems that each user will have only one record). It also allows you, as admin, to have complete access to all of the functions of the database.
------------------
JPD

Unoffical DBMan FAQ

http://creativecomputingweb.com/dbman/index.shtml/
Quote Reply
Re: [LoisC] User search In reply to
Hi LoisC,

Thanks for the help. That does work, but I probably should have explained myself a little more. I the key field is actually a ticket number that automatically counts up after each entry into the database. On a given day the user will probably enter 40 records. There are multiple users using this database, so the counting of the records for each person doesn't go up evenly. Example: joesmith gets ticket number 1, susan gets ticket number 2, joesmith gets ticket number 3, bobby gets ticket number 4, etc....

Anyways... I just want a link that I can click on to show all of joesmith's entries into the database instead of searching. Of course whoever is logged in it will show just their entries. I'm not sure if I have to set a link up such as:

$db_script_link_url?view_records=1&$db_userid&sb=9&so=descend

sb=9 is the field which relates to time in my database.

I've tried this, but I've had no luck. Any suggestions?

Thanks!
Dave
Quote Reply
Re: [dhoefler] User search In reply to
I'm not sure if I can use the following, as a template:

sub view_records {

my ($status, @hits) = &query("view");

if ($status eq "ok") {

&html_view_success(@hits);

}

else {

&html_view_failure($status);

}

}



--------------------

I get lost when I'm trying to figure out where $userid goes.

Quote Reply
Re: [dhoefler] User search In reply to
In Reply To:
$db_script_link_url?view_records=1&$db_userid&sb=9&so=descend

sb=9 is the field which relates to time in my database.

I've tried this, but I've had no luck. Any suggestions?

Thanks!
Dave

I think the problem is using $db_userid - this will probably give you something like "joesmith.12345678912313" which is the username and the session variable (if I'm not mistaken).

Here is what I use:

<A HREF="$db_script_link_url&modify_record=1&type=order&ID=$rec{'ID'}&userid=$in{'userid'}">

take out &type=order and make ID=$rec{'ID"} equal ID=* (assuming your record number is called ID)

Play around with it. It should work.

If not, post your default.cfg file and we'll *make* it work. Wink

.

Last edited by:

Watts: Oct 3, 2003, 3:49 PM
Quote Reply
Re: [Watts] User search In reply to
Hi Watts... that is exactly what I was thinking. I've tried messing around with what you were suggesting. I've had no luck. I've changed 'ID' to 'Ticket Number' cause that is my key. Anyways... I thought I would post the text files of the config and html files to see if you might see anything I'm doing wrong.

http://www.davehoefler.com/html.txt

http://www.davehoefler.com/default.txt

Thanks for all your help,
Dave
Quote Reply
Re: [dhoefler] User search In reply to
The spaces in your field names are probably what is causing your problems.

Try this...

Code:
<A HREF="$db_script_link_url&view_records=1&Ticket%20Number=*&User%20ID%20(leave%20blank)=$in{'User ID (leave blank)'}">

Not sure this will work, the spaces and the parenthesis will most likely cause problems in the URL string. Chances are the parenthesis will have to be converted to something (like spaces are converted to %20). I'm not real sure about this though.
Quote Reply
Re: [Watts] User search In reply to
For the space you should be able to just use rather than:

Ticket%20Number=

Ticket+Number=

I use that method on several static page with link listings.

Unoffical DBMan FAQ

http://creativecomputingweb.com/dbman/index.shtml/