Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| codeigniter [2010/09/10 02:47] – newacct | codeigniter [2011/03/07 21:09] (current) – rfile | ||
|---|---|---|---|
| Line 142: | Line 142: | ||
| </ | </ | ||
| + | </ | ||
| + | <box|use of row_array()> | ||
| + | <code php> | ||
| + | /** | ||
| + | * Note the use of row_array to get | ||
| + | * array of one row instead of object | ||
| + | * this will matter later in the whole | ||
| + | * array that is passed to the view | ||
| + | * @param string $wfield | ||
| + | * the column we want to average | ||
| + | * @param string $avgname | ||
| + | * this is for the " | ||
| + | * @param string $tablename | ||
| + | * the name of the table the column is in | ||
| + | * @return array | ||
| + | * | ||
| + | */ | ||
| + | function get_avg($wfield, | ||
| + | $this-> | ||
| + | $query = $this-> | ||
| + | $avgdata = $query-> | ||
| + | return $avgdata ; | ||
| + | } | ||
| + | |||
| + | } | ||
| + | |||
| + | |||
| + | </ | ||
| + | </ | ||
| + | <box | second database> | ||
| + | <code php> | ||
| + | |||
| + | <?php | ||
| + | class Model_old_info extends CI_Controller { | ||
| + | |||
| + |  | ||
| + | { | ||
| + | parent:: | ||
| + | // Your own constructor code | ||
| + | $CI =& get_instance() ; | ||
| + |  | ||
| + |  | ||
| + | } | ||
| + |  | ||
| + | |||
| + | |||
| + |  | ||
| + |  | ||
| + |  | ||
| + |  | ||
| + | } | ||
| + | return $table_data; | ||
| + | } | ||
| + | } | ||
| + | |||
| + | </ | ||
| + | |||
| + | |||
| + | |||
| + | ' | ||
| + | |||
| + | |||
| </ | </ | ||