# Thread: dbmopen() giving fatal error

1. ## dbmopen() giving fatal error

Hi,

I am designing a questionnaire for my site using php and mySQL (although at present mySQL isn't yet installed so I thought great use dbm.... - so she thought)

But when I type this small script:

<?php
$dbh = dbmopen ( ".data", "c" ) or die( "Couldn't open DBM" ); dbmclose ($dbh);
?>

in an html page and called dbm.php, I get this huge error in IE

Fatal error: Call to undefined function: dbmopen() in c:\PROGRA~1\sambar44\docs\usersurvey\dbm.php on line 9

where line 9 corresponds to the dbmopen() part.

As I am using sambar server I checked through the search facility and re checked the instructions by kevin (great tutorial also!) but its still doesn't work.

One very very frustrated web dev..... with a deadline for monday evening!!!!

Any help would be appreciated I was wondering whether read/write access was the problem but everything is fullcontrol access!?

Sarah

2. Okay here's some tips for you to use dbm perhaps this might help you to solve your problem.

The first argument is the full path file name of the DBM file to be opened,

and the second is the file open mode which is one of the following
"r" = standing for read only

"n" = new(implies read-write, and most likely will truncate an already existing database of the same name)

"c" = create(implies read-write, and most likely will NOT truncate an already existing database of the same name)

int dbmopen(string filename, string mode)

hope this will help

3. just to check a few points;

by full file name do you mean c:..... etc or just from your working root directory?

and also if you are creating one surely it should create it regardless of the full directory?

I did know about the read write etc and started of with c to create but that still isn't working (actually following tutorial in book...)

Anyway I have tried it but for some reason it still objects to the dbmopen() part?!

and if I write int dbmopen("new", "c")

I now get

Parse error: parse error in c:\PROGRA~1\sambar44\docs\usersurvey\dbm.php on line 10

Next question can you create a dbm without using php i.e. is it something I can create and then look for to see if that works?

Thanks for the info though

Sarah

4. yes, try use the full path file name such as c:\to\where\is\your\database

please dont write int dbmopen("new", "c")

you should write dbmopen("c:\to\where\is\your\database","c")

the int infront of it just represent the return value whether the function is done successfully or not.

5. nope still not working... I wrote

$dbh = dbmopen ( "c:\PROGRA~1\sambar44\docs\usersurvey", "c" ) or die( "Couldn't open DMB"); and got the same error message Fatal error: Call to undefined function: dbmopen() in c:\PROGRA~1\sambar44\docs\usersurvey\dbm.php on line 11 I also created a database to see if I could open that and I couldn't! Never mind I shall sleep on it and see what happens, thank you very much for your help - even if we didn't get to teh bottom of it.... Sarah 6. Try This... I think it should work$file = 'c:\PROGRA~1\sambar44\docs\usersurvey';

$dbh = dbmopen ($file, "c" ) or die( "Couldn't open DMB");

7. I just found out a lot of other people are having the same problem. They say you should recompile php with-ndb *and* --with-db, then it should work

8. manipura,

[thank you thank you, bow scrape floor]

cheers I shall try it later when I download all the stuff tonight (at home now) but can you clarify something (still fairly new at this i.e. i've been doing it about 5 hours so far) biu what do you mean recompile php with-ndb *and* --with-db - as basic words as possible.

Nice to know that I am not the only one who is having problems! Although might download mySQL this evening anyway... hey who wants a friday night out anyway

Your help is MUCH appreciated one very frustrated female php programmer (no remarks thank you!)

I also dip into many other languages too jack of all trades really, XML next, haven't done asp much got jsp and perl not too bad...

Sarah

9. recompile... I think its like reinstall or something along those lines. I'm not to familiar with that sort of thing. I'm just the programmer, I don't control the server. Never have, and pribably won't (for at least a few months anyway). I know nothing about installing MySQL or PHP or anything about apache. I just know how to build and structure a site using PHP and MySQL. Hey, I have only been in the industry for 6 or 7 months now.. Don't expect me to know everything now do you? Although I have been slowly learning lingo (just for fun). Making games and stuff.

I think you should get MySQL.. I have it and I love it. Lots of people have it so its not hard to find help.

one very frustrated female php programmer (no remarks thank you!)
Sorry, just have to tease you. But of course you are fustrated, who wouldn't be? I get mad if a script decids not to work. I don't know what its like coming from a female point of view. I don't know many female programmers but it is nice to see at least some out there. The male and female mind works differently (Duh!) but men are for understanding and logic. Women are for experiencing and emotion. Although in this insane world men take over everything. Women should be the ones out being the artists. Men should be out there Builing the walls those peices of art stand upon.

Sorry for spilling my guts out here, I just need a reason not to work today. Ha Ha... I should be working. But I'm in a lazy mood. If you want to find out more go into general chat forum and see my post on christianity. (Hope your not religious)

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•