[[dbStore()]]
Translations of this page:
 

dbStore()

The dbStore() function stores a data object in the Database for Contents.

void dbStore(string key, mixed data object)

  • key
    The database key to be created, updated or deleted. The key must be between 2 and 63 characters long. Special characters (e.g., ä ö ü) may require more than one character.
  • data object
    This can be a single value or an indexed or associative array. Nested arrays are also possible.

Please note that objects that you store in the content database using dbStore() can only be read using dbRetrieve(), not using dbGet().

Application example

The following PHP code would use the named array indices age, gender and response to store two response values and all responses from the AB01 scale as an array.

$data = [
  'age' => value('SD01_01'),
  'gender' => value('SD02'),
  'response' => valueList('AB01')
];
$person = caseSerial();
dbStore($person, $data);

The following object would then be stored in the database for content:

{
    age: 19,
    gender: 2,
    response: {
        AB01_01 => 3,
        AB01_02 => 1,
        AB01_03 => 2,
        AB01_04 => 3
    }
}

en/create/functions/dbstore.txt · Last modified: by anja.vandersmissen
 
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
Driven by DokuWiki