codeigniter
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
codeigniter [2010/05/26 19:37] – created rfile | codeigniter [2011/03/07 21:09] (current) – rfile | ||
---|---|---|---|
Line 5: | Line 5: | ||
[[http:// | [[http:// | ||
+ | |||
+ | |||
+ | [[http:// | ||
<box 70% blue | controller from lesson 5 CRUD> | <box 70% blue | controller from lesson 5 CRUD> | ||
<code php> | <code php> | ||
Line 140: | Line 143: | ||
</ | </ | ||
</ | </ | ||
+ | <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; | ||
+ | } | ||
+ | } | ||
+ | |||
+ | </ | ||
+ | |||
+ | |||
+ | |||
+ | ' | ||
+ | |||
+ | |||
+ | </ | ||
+ | |||
+ | ===== javascript - pass data to php and get json array back ===== | ||
+ | |||
+ | < | ||
+ | <code javascript> | ||
+ | $(function() { | ||
+ | $('# | ||
+ | var wpt = $(' | ||
+ | alert(wpt); | ||
+ | $.post("/ | ||
+ | |||
+ | | ||
+ | $("# | ||
+ | | ||
+ | }," | ||
+ | }); | ||
+ | |||
+ | }); | ||
+ | </ | ||
+ | </ | ||
+ |
codeigniter.1274920624.txt.gz · Last modified: 2010/05/26 19:37 by rfile