readfile and insert to db help - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: readfile and insert to db help (/showthread.php?tid=26632) Pages:
1
2
|
readfile and insert to db help - El Forum - 01-19-2010 [eluser]sasori[/eluser] I created a folder named "file" outside the system folder. now here's my controller function Code: function add() and this is my model function to read the file Code: function putData($txt) now am getting this error Quote:A PHP Error was encountered Quote:Fatal error: Call to a member function putData() on a non-object in C:\xampp\htdocs\myapp\system\application\controllers\welcome.php on line 23 please tell me what to do ? readfile and insert to db help - El Forum - 01-19-2010 [eluser]flaky[/eluser] put this in the contructor Code: $this->load->model('stock_model'); readfile and insert to db help - El Forum - 01-19-2010 [eluser]hendrawan[/eluser] this probably becouse you haven't call your model Code: $this->load->model('Stock_model'); readfile and insert to db help - El Forum - 01-19-2010 [eluser]sasori[/eluser] is that mandatory even if it database is already autoloaded ? readfile and insert to db help - El Forum - 01-19-2010 [eluser]flaky[/eluser] yes it is readfile and insert to db help - El Forum - 01-19-2010 [eluser]sasori[/eluser] now i am getting these Quote:A PHP Error was encountered Quote:A PHP Error was encountered Quote:A PHP Error was encountered btw, i attached the sample file so you have idea what i was trying to read and attempting to insert into the db readfile and insert to db help - El Forum - 01-19-2010 [eluser]flaky[/eluser] put the code of stock_model.php here readfile and insert to db help - El Forum - 01-19-2010 [eluser]sasori[/eluser] ok sir this is my stock_model Code: class Stock_model extends Model readfile and insert to db help - El Forum - 01-19-2010 [eluser]flaky[/eluser] at the Code: $a[$i][1] = preg_replace("/\s\%/","%",$a[$i][1]); readfile and insert to db help - El Forum - 01-19-2010 [eluser]flaky[/eluser] for debugging do a Code: print_r($a); |