dba_replace and inifiles

This is a discussion on dba_replace and inifiles within the PHP Language forums, part of the PHP Programming Forums category; I am using an inifile under the dba calls to store some info. Everything is working fine except dba_replace. It ...


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 03-04-2006
Buzz Burrowes
 
Posts: n/a
Default dba_replace and inifiles

I am using an inifile under the dba calls to store some info. Everything
is working fine except dba_replace. It always fails. I am sure the key I
am passing in exists. Here is some code...

function ModifyAValue($group,$key,$index,$value,$db)
{
// $key_array = array($group, $key . $index);
$key_array = "[" . $group . "]" . $key . $index;
if(dba_exists($key_array,$db) == TRUE)
{
echo "KEY EXISTS!\n";
}
if(dba_replace($key_array,$value,$db)== FALSE) return FALSE;
return TRUE;
}

When I execute the code above (with the key as either an array or a
string) I DO get the KEY EXISTS echo... so the key is found, but the
dba_replace always returns false. I couldn't find anything in the docs
that said dba_replace doesn't work for inifiles.

Anyone have any ideas?

Thanks,
Buzz

Reply With Quote
  #2 (permalink)  
Old 03-05-2006
Buzz Burrowes
 
Posts: n/a
Default Re: dba_replace and inifiles

Interesting... I just tried to implement deleteing keys and I have the
same exact problem... a return of FALSE from dba_delete... even after an
previos check with dba_exists returns true for the same exact key.


Hmmmm. Any help would be greatly appreciated.

I guess I could move away from inifiles and use a flatfile database
instead... but I like the idea of being able to edit in ini file in a
text editor should I need to correct something or tweak something
without building a PHP script to do it.

Best,
Buzz


Buzz Burrowes wrote:

> I am using an inifile under the dba calls to store some info. Everything
> is working fine except dba_replace. It always fails. I am sure the key I
> am passing in exists. Here is some code...
>
> function ModifyAValue($group,$key,$index,$value,$db)
> {
> // $key_array = array($group, $key . $index);
> $key_array = "[" . $group . "]" . $key . $index;
> if(dba_exists($key_array,$db) == TRUE)
> {
> echo "KEY EXISTS!\n";
> }
> if(dba_replace($key_array,$value,$db)== FALSE) return FALSE;
> return TRUE;
> }
>
> When I execute the code above (with the key as either an array or a
> string) I DO get the KEY EXISTS echo... so the key is found, but the
> dba_replace always returns false. I couldn't find anything in the docs
> that said dba_replace doesn't work for inifiles.
>
> Anyone have any ideas?
>
> Thanks,
> Buzz
>


Reply With Quote
  #3 (permalink)  
Old 03-05-2006
Buzz Burrowes
 
Posts: n/a
Default Re: dba_replace and inifiles

I guess I should also mention that the ini file is one I am creaing with
other dba calls... and I can create keys no problem (evident from
looking in the file AND given that dba_exists returns true as described.)

So... I don't *think* it is a permissions problem... but I am stumped.

- Buzz

Buzz Burrowes wrote:

> I am using an inifile under the dba calls to store some info. Everything
> is working fine except dba_replace. It always fails. I am sure the key I
> am passing in exists. Here is some code...
>
> function ModifyAValue($group,$key,$index,$value,$db)
> {
> // $key_array = array($group, $key . $index);
> $key_array = "[" . $group . "]" . $key . $index;
> if(dba_exists($key_array,$db) == TRUE)
> {
> echo "KEY EXISTS!\n";
> }
> if(dba_replace($key_array,$value,$db)== FALSE) return FALSE;
> return TRUE;
> }
>
> When I execute the code above (with the key as either an array or a
> string) I DO get the KEY EXISTS echo... so the key is found, but the
> dba_replace always returns false. I couldn't find anything in the docs
> that said dba_replace doesn't work for inifiles.
>
> Anyone have any ideas?
>
> Thanks,
> Buzz
>


Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 12:07 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0