Gossamer Forum
Home : Products : DBMan : Customization :

.count file empty after adding an entry

Quote Reply
.count file empty after adding an entry
I have a heavily modified version of DBMan for a job posting database. I am having a strange error.

When a user adds a new entry, it goes to the html_add_success page and says it was successfully added, but in the .db file, there is no ID number recorded in the entry. Also, the number in the .count file is gone, the file is totally empty.

If you add another job right afterwards it assigns it to ID 1 and lets you start posting from there. When another user logs in however, the process starts over.

Note that the form *does* display the correct ID number on the add form page.

Anyone have any ideas about where I can even start looking? Ive been searching for hours.

Quote Reply
Re: .count file empty after adding an entry In reply to
Hello Morgan, are you using the ID field as the db key?

Can you save your .cfg and html.pl files as text files and upload them to a web accessible area of the server so the two files can be viewed?

Quote Reply
Re: .count file empty after adding an entry In reply to
I put the two files you requested up at:

http://jobs.colostate.edu/dbman.html

Hope this helps. The page is about 136K. Unfortunately, a lot of the modifications have not been well commented, they were done before I took over this project.

Quote Reply
Re: .count file empty after adding an entry In reply to
Hi Morgan, I'm not absolutely certain however, I don't believe you can have all those if statements in the config file :) The config file is defining your db so it isn't able to parse those ifs.

Try removing those - save a backup of your file first - then, try uploading the file again and see what happens.

Please, Morgan, if you could - save the files as actual text files without all the extra page layout in there. I am able to copy the file and load into a temp file to check syntax, etc when it is straight text only.


Quote Reply
Re: .count file empty after adding an entry In reply to
I went ahead and removed the if statements and there was no change in the behavior. The first entry still appears with no ID number, and the .count file is emptied. When a different user goes to enter a job, it assigns it to ID 1 (even though there already is one).

Also, I put links to the actual files up so they can be downloaded. (see URL in post above)

Quote Reply
Re: .count file empty after adding an entry In reply to
 
One problem I caught right away was this field should be number 19. Having two fields with the same number will cause some weird problems.

'apptype' => [13, 'alpha', 0, 255, 1, '', 'A|B|None'],

Once you change that to the correct field number let us know if it solves the problem.

Also check the permissions on your count file.

Hope this helps

Unoffical DBMan FAQ
http://webmagic.hypermart.net/dbman/
Quote Reply
Re: .count file empty after adding an entry In reply to
Fixed that typo in the .cfg file but it did not solve my problem.
I also made sure all the permissions on my files were set correctly (and they were).
Nothing has changed :(

Quote Reply
Re: .count file empty after adding an entry In reply to
I know I have seen posts where the count file was being deleted, but it has been awhile.

I would highly suggest at this point to check over all your coding to be sure there are no errors which could be causing this. And perhaps search the forum for "count file", "count deleted" and perhaps a few other verions of your problem and see if you can find a post which will help you solve the problem.

What other mods do you have installed if any?

I ask this only because a few years ago this was happening to others only when they were trying new mods.

Unoffical DBMan FAQ
http://webmagic.hypermart.net/dbman/
Quote Reply
Re: .count file empty after adding an entry In reply to
I spent the last couple days going through my code line by line looking for the problem. I found some unmatched parenthesis in the .pl file, some i was able to eliminate but there are two apparantly unmatched that when commented out cause syntax errors and kill the database. I put the newest versions of my .pl and .cfg files up online to be viewed at http://www.jobs.colostate.edu/dbman.html

the unmatched parenthesis are on lines 431 and 807, the have a comment "# ???" to the right of them. Any suggestions on where to go from here would be very helpful.

Thanks

Quote Reply
Re: .count file empty after adding an entry In reply to
I only viewed your .cfg file at this time and noticed you have variables within the definition for 'not_null'. This is probably causing many problems as you can not use those in your definitions as Karen stated.

'college' => [ 5, 'alpha', 0, 255, $req_college, '', ''],
'killdate' => [11, 'date', 50, 255, $req_killdate, &get_date(), ''],
'examinfo' => [14, 'alpha', 40x3, 5000, $req_examinfo, '', ''],

If you want to add conditional statements when adding a record your best bet would be to put those with your db.cgi with the sub add_record subroutine.

Your conditions may work if you move them to that location. And keep your default value empty within the .cfg file.

I didn't view your .pl file as I think the error may be caused by your if statements within your .cfg file. It's much easier to get one part fixed and then continue to pinpoint other errors.

Hope this helps

Unoffical DBMan FAQ
http://webmagic.hypermart.net/dbman/
Quote Reply
Re: .count file empty after adding an entry In reply to
I moved the if statements out of my cfg file and into the sub add_record subroutine. Those conditional statements are still working properly but my error still continues. Anyone have any more ideas?

Quote Reply
Re: .count file empty after adding an entry In reply to
I would suggest getting a program which will help to locate all missing brackets so you can pinpoint the problem.

Having a bracket in the wrong place can also cause the count file to get deleted.

In the FAQ noted below under "Troublshooting" there is a reference to a script called "Finding missing brackets in your scripts".

I always run this on my scripts to be sure everything is correct. Be sure to look above the lines it states at times as the error could begin at the top of a sub.

Also make sure even with your comment lines there is no extra brackets as they will display in the error report you get.

I hope this helps, I know it can be frustrating to find this type of error. You may need to check each mod installed and match the instructions with what you have to find the error also. It is most likely that one line of code is being closed too soon.

Unoffical DBMan FAQ
http://webmagic.hypermart.net/dbman/
Quote Reply
Re: .count file empty after adding an entry In reply to
Thanks for the suggestion. The link in the troubleshooting FAQ no longer exists. I have spent quite a bit of time searching through my code for misplaced parenthesis and cannot find any.

Can anyone suggest a really good text editor for Perl that does parenthesis matching? If so, can you provide a link to download it?

Quote Reply
Re: .count file empty after adding an entry In reply to
Edit Plus: http://www.editplus.com
TextPad: http://www.textpad.com

Regards,

Eliot Lee

Quote Reply
Re: .count file empty after adding an entry In reply to
I used textpad to figure out where my parenthesis errors were and fixed them. I am still having the same problem though. Anyone have any suggestions on where to go from here?

My db.cgi, .pl, and .cfg files are available to view at:
http://www.jobs.colostate.edu/dbman.html

Quote Reply
Re: .count file empty after adding an entry In reply to
I think I see the problem...

In html.pl, in sub html_record_form, you have the following code:
Code:

if (($per_admin) or ($per_mod and $in{'view_search'})) {
print qq|
<TR><TD ALIGN="Right" VALIGN="TOP" WIDTH="150"><$font_color>ID:</FONT></TD>
<TD VALIGN="TOP" WIDTH="475">
<INPUT TYPE="TEXT" NAME="ID" SIZE="20" VALUE="$rec{'ID'}" MAXLENGTH="255">
</TD></TR>
|;
}
elsif (($per_mod) and ($in{'modify_form'} or $in{'add_form'})) {
print qq|
<TR><TD ALIGN="Right" VALIGN="TOP" WIDTH="150"><$font_color>ID:</FONT></TD>
<TD VALIGN="TOP" WIDTH="475"><$font>$rec{'ID'}</TD></TR>
|;
}

else {
print qq|
<input type="hidden" NAME="ID" VALUE="$rec{'ID'}">
|;
}
It's a simple logic problem:

- If the user has admin rights, print an ID text box. This is fine
- If the user has modify rights, just print the ID to the screen. But what about the form field?
- Otherwise, print a Hidden ID field. This is fine

If the user fits into the second category, a form field for ID is never created, DBMan never recieves one, so it prints nothing into the count file. And this happens:
In Reply To:
If you add another job right afterwards it assigns it to ID 1 and lets you start posting from there. When another user logs in however, the process starts over.
The next time around, DBMan opens the count file, adds 1 to nothing, and you're presented with the ID of 1 you keep getting. If you submit the record, it prints nothing into the count file again.

Hope this clears things up.

- Mark


Astro-Boy!!
http://www.zip.com.au/~astroboy/
Quote Reply
Re: .count file empty after adding an entry In reply to
Hello Morgan,

Re: text editors and perl - I'd make a very strong suggestion that you review back in through this forum and locate a thread titled, "Trouble with sub html_page_bottom routine" somewhere around 2-Aug-00

JPDeni provided a step-by-step outline on installing activeperl and setting it up for use with EditPlus. This combination has been an invaluable resource for me in working with dbman and other perl scripts.

I used the very same instructions JPDeni posted and it has saved me many, many hours of debugging/troubleshooting time already.

Hope you've been able to get things going on your db files - I lost track of where you're at on the project <smile>


Karen

Quote Reply
Re: .count file empty after adding an entry In reply to
Oh happy day, it worked it worked it worked.

Thank you *so* much everybody. Don't you just hate it that all those nightmarish bugs are always so obvious when theyre found? :)

AstroBoy is my new friend!

Quote Reply
Re: .count file empty after adding an entry In reply to
Great catch Mark !!!!!

Very glad to have you back helping out in the forums Smile

Unoffical DBMan FAQ
http://webmagic.hypermart.net/dbman/