Gossamer Forum
Home : Products : Gossamer Links : Version 1.x :

Modify a record -- DBSQL.pm

Quote Reply
Modify a record -- DBSQL.pm
I want to let users modify their record by themselves (and I don't have to validate it). So I use this in modify.cgi:
Code:
$db = new Links: BSQL "$LINKS{admin_root_path}/defs/Links.def";
$db->modify_record ($rec) or &site_html_modify_failure ( { Category => $category, error => $Links: BSQL::error, %in }, $dynamic) and return;
There were 9 records in my Links Table. At first, I could modify every record through modify.cgi.
Then, I deleted ID:1,2,5,7 through admin. The followings were left: 3, 4, 6, 8, 9.
I tried to modify them through modify.cgi. I successfully modified ID:4,
but when I tried to modify ID:3, there was error message: The requested record was not found in the database.
Then I tried ID: 8 and failed(same error message). So I Re-Index, then i found I couldn't modify any record (even ID:3).
Then I added a record through add.cgi(It was ID:10). I successfully modified ID:10 through modify.cgi, then I Re-Index, and I couldn't modify ID:10.

How do I fix this? Thank you.



[This message has been edited by Fortune (edited February 17, 2000).]
Quote Reply
Re: Modify a record -- DBSQL.pm In reply to
I think I find the problem.
My modify.cgi works like this:
The User enters his ID and Password, modify.cgi will load all his old data from Table Links to the browser, after he changes his data and clicks submit, his new data will update into Table Links directly.

However, when the user doesn't change anything and click submit, he will get an error message: The requested record was not found in the database. If he changes something, it will work fine.

Although the above error message prevents the user from modifying nothing, but the error message is really confusing. And I just don't understand why modifying nothing will cause this error.

The error message comes from DBSQL.pm:
Code:
# Update the indexes.
$self->update_index ($rec_r->{$key}, $rec_r) if ($self->{db_is_indexed});
($rc == 0) ? return $self->error ('NOTFOUND') : return 1;

Does anyone know how to solve this?
Your help will be very appreciated.