[[dbGet()]]
 

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
en:create:functions:dbget [24.01.2015 14:06] – [Return Value] alexander.ritteren:create:functions:dbget [29.01.2025 13:29] (current) robin.bodenberger
Line 1: Line 1:
 ====== dbGet() ====== ====== dbGet() ======
  
-Data can be retrieved from the **Database for Contents** with ''dbGet()''More details can be found in the chapters [[:en:create:databank|Database for Contents]] and ''[[:en:create:functions:dbset|dbSet()]]''. +''dbGet()'' can be used to retrieve data from the **content database**. For details and examples, see [[:en:create:databank|Using data fragments in PHP code]] and ''[[:en:create:functions:dbset|dbSet()]]''.
  
 ''array|false **dbGet**(string //key//)'' ''array|false **dbGet**(string //key//)''
  
-  * //key//\\ The database key for which data is stored+  * //key//\\ The database key for which data has been stored
 + 
 +**Important:** ''dbGet()'' can only retrieve data that has been imported as a table or entered into the content database using ''[[en:create:functions:dbset]]''. The command cannot retrieve complex data structures that have been stored using ''[[en:create:functions:dbstore|dbStore()]]''. Use ''[[en:create:functions:dbretrieve|dbRetrieve()]]'' for that. 
 + 
 +**Important:** The content database can store content in different language versions ([[:en:create:multilang]]) for the same key. If several language versions exist for a key, ''dbGet()'' returns the entry for the current interview language. 
 + 
 +===== Return value =====
  
-===== Return Value =====+If the specified //key// exists in the database, the function __always__ returns an [[:en:create:array|Array]] -- even if only one value was stored for the //key//.
  
-If the specified //key// exists in the database, the function always returns an array -- even if only one value was stored for the //key//.+If the specified //key// is not found in the database, the function returns ''false''. In debug mode ({{:button.debug.gif?nolink|Start questionnaire in debug mode}}), but not in the finished questionnaire, a warning is also displayed if the key was not found.
  
-If the specified //key// cannot be found in the database, the function returns ''false''. In debug mode (({{:button.debug.gif?nolink|Start questionnaire in debug mode}}) (not in finished questionnaires), a warning will also be displayed if the key cannot be found. 
  
en/create/functions/dbget.1422104811.txt.gz · Last modified: by alexander.ritter
 
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
Driven by DokuWiki