Gossamer Forum
Home : Products : DBMan : Customization :

Number of Database Listings.

Quote Reply
Number of Database Listings.
I've done a search but couldn't find if it's been dicussed before, although I'm sure it has.

My question is this. On the main login screen for DBman, I have the standard blah, blah, blah. But I want it to say, "There are currently 500 listings in Database"

I know this can be done for Links but I wasn't sure if it's the same for DBMan.

Thanks!

------------------
Sean Fay

Aurora Web - Professional Web Hosting loaded with features.
http://www.auroraweb.net
Quote Reply
Re: Number of Database Listings. In reply to
I think this should work:

Code:
open (DB, "<$db_file_name") or &cgierr("error in search. unable to open database: $db_file_name.\nReason: $!");
if ($db_use_flock) { flock(DB, 1); }
@lines = <DB>;
close DB;
$items = scalar(@lines);

Then use the variable $items where you want to print out the number of records.


------------------
JPD




[This message has been edited by JPDeni (edited March 11, 1999).]
Quote Reply
Re: Number of Database Listings. In reply to
Yep, it works quite nicely! Thanks for yet another mod!


------------------
Jason
Extreme mtb
http://extreme.nas.net
Quote Reply
Re: Number of Database Listings. In reply to
Thank you - I'm looking for this as well. As I am a Perl/CGI illiterate, any help on how to pop this piece of code into its own CGI file that I can call through an SSI statement from any page to show the number of records?



------------------
Safe swoops
Sangiro

www.dropzone.com
Quote Reply
Re: Number of Database Listings. In reply to
I'm afraid I can't help you with SSI. With any luck someone else will be able to help.



------------------
JPD





Quote Reply
Re: Number of Database Listings. In reply to
All you need to do is:

Code:
#!/usr/bin/perl
print "Content-type: text/html\n\n";
open (DB, "/path/to/default.db") or print "Cant' find db!";
while (<DB> ) { $count++; }
close DB;
print $count;
# ------------------------------------------

and then call it <!--#exec cgi="/path/to/cgi/file"-->

Cheers,

Alex
Quote Reply
Re: Number of Database Listings. In reply to
Thank you Alex!

Here are some flowers for you guys...

I've got more scripts running on my new web site then I care to know. So, being a bit of a dud with PERL I need to ask for help and advice often.

I have not come across the level of advice and responsiveness that I receive in these forums anywhere else on the web.

Your team certainly builds great scripts and your support kicks ass!

Keep it up.




------------------
Safe swoops
Sangiro

www.dropzone.com