![]() |
access variable from different method within same model class - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: access variable from different method within same model class (/showthread.php?tid=24283) |
access variable from different method within same model class - El Forum - 11-05-2009 [eluser]ranjitbd[/eluser] // this is a model class class Holiday_model extends Model { function Holiday_model() { parent::Model(); $this->load->database('holiday', TRUE); } function view_package() { $sql = "select * from package_details"; // i want to use this $sql in the method get_package_details()mentioned below $query = $this->db->query($sql); return $query->result_array(); } function get_package_details($id) { // here how can i access the $sql from view_package() method mentioned above.and set it within $new_sql $new_sql = ;//please write here the code $row = $new_sql." where id = '$id'"; $query = $this->db->query($row); return $query->row_array(); } } ?> access variable from different method within same model class - El Forum - 11-05-2009 [eluser]Krzemo[/eluser] Code: // this is a model class |