Problem wih get_option and update option.
-
I am having an issue with the following code:
// delete_option('lcw_common_library'); $options = get_option('lcw_common_library'); $status = var_dump($options); if ($options) { $options['common_access_count'] = $options['common_access_count'] + 1; } else { $options['common_access_count'] = intval(1); } $status .= var_dump($options); update_option('lcw_common_library', $options, false); $status .= var_dump($options); exit ($status." Copies completed");
If I un-comment the first line, the delete_option, I get
bool(false) array(1) { [“common_access_count”]=> int(1) } array(1) { [“common_access_count”]=> int(1) }
as expected and the value 1 is properly stored in the db. If I re-comment it I get the following:
array(1) { [“common_access_count”]=> int(3) } array(1) { [“common_access_count”]=> int(4) } array(1) { [“common_access_count”]=> int(4) } Copies completed
For some reason, the db had a value of 1 but read 3 which I bumped to 4 and stored.
Any ideas?
Environment id XAMPP running on my PC.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Problem wih get_option and update option.’ is closed to new replies.