Find

Navigation:  Development > Function Reference > Model >

Find

Previous pageReturn to chapter overviewNext page

This function fetch a singe row from a table. See bellow format
 

App::Model(MODEL)->find(CONDITION);
 

 
If we use just find() then it return a singe entry of table following default insert sequence. Also we can pass condition of WHERE clause as parameter of the function.

 

For example: 
$list = App::Model('Page')->find("id=1"); 
$list = App::Model('Page')->find("1 ORDER BY id ASC"); 
 
// Return value
/*
Array
(
    [id] => 1
    [fkey] => 0
    [page_title] => About appRain
    [meta_keywords] => appRain, CMS,Framework
    [meta_description] =>appRain is a combination of  CMS and Framework
    [name] => aboutus
    [title] => About Us
    [content] =>appRain is one of the first officially released Open Source Content Management Framework (CMF)
    [hook] => sitemenu,quicklinks
    [userdefinehook] => 
    [richtexteditor] => Yes
    [rendertype] => smart_h_link
    [contenttype] => Content
)*/

 

Note: In present appRain version 3.1.0 and 3.1.2 by default this function return all data in a single but we can customize it to fetch value of particular column. 
 
$list = App::Model('Page')->find("1 ORDER BY id ASC",NULL,"id,name"); // Return id and name of each row