![]() |
selecting data from 2 tables - 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: selecting data from 2 tables (/showthread.php?tid=40702) |
selecting data from 2 tables - El Forum - 04-16-2011 [eluser]Bigil Michael[/eluser] it shows error like this Fatal error: Unsupported operand types in C:\xampp\htdocs\draksha\system\libraries\Pagination.php on line 112 selecting data from 2 tables - El Forum - 04-16-2011 [eluser]toopay[/eluser] Did you extract the array before passing it to pagination config? selecting data from 2 tables - El Forum - 04-16-2011 [eluser]Bigil Michael[/eluser] no. how to extract???? i didn't used this method most of the time i calculate the value of count directly selecting data from 2 tables - El Forum - 04-16-2011 [eluser]toopay[/eluser] Modify one of your model function to above ilustration, then in your controller, extract the array... Code: $constituency = $this->Election_result_model->select_constituency($config['per_page'], $pgoffset); selecting data from 2 tables - El Forum - 04-16-2011 [eluser]Bigil Michael[/eluser] but it shows the error like this A PHP Error was encountered Severity: Notice Message: Undefined index: data Filename: controllers/election_result.php Line Number: 25 A PHP Error was encountered Severity: Notice Message: Undefined index: total Filename: controllers/election_result.php Line Number: 26 A PHP Error was encountered Severity: Warning Message: Invalid argument supplied for foreach() Filename: controllers/election_result.php Line Number: 29 and nothing is displayed in the result page result page also contains error Fatal error: Unsupported operand types in C:\xampp\htdocs\draksha\system\libraries\Pagination.php on line 112 selecting data from 2 tables - El Forum - 04-16-2011 [eluser]toopay[/eluser] In your controller, change above parts to this and post its result. Code: $constituency = $this->Election_result_model->select_constituency($config['per_page'], $pgoffset); selecting data from 2 tables - El Forum - 04-16-2011 [eluser]Bigil Michael[/eluser] now that problem cleared thank you so muchhhhhhh selecting data from 2 tables - El Forum - 04-16-2011 [eluser]Bigil Michael[/eluser] one more help please my table Quote:id constituency_id candidate_name candidate_votes elect_year i want to select cndidate name who has max:candidate votes i searched but i didn't get result code me used is Quote:function select_win() it prints maximum votes not candidate votes i want the candidate name can u help me?? thanks in advance........ selecting data from 2 tables - El Forum - 04-16-2011 [eluser]Bigil Michael[/eluser] now it shows an error like this Quote:A Database Error Occurred can any one solve my problem thanks in advance.. selecting data from 2 tables - El Forum - 04-16-2011 [eluser]toopay[/eluser] Use sub-query instead... Code: $query = $this->db->where('constituency_id', $id) |