Welcome Guest, Not a member yet? Register   Sign In
selecting data from 2 tables
#11

[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
#12

[eluser]toopay[/eluser]
Did you extract the array before passing it to pagination config?
#13

[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
#14

[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);
$fleets = $constituency['data'];
$config['total_rows'] = $constituency['total'];
#15

[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
#16

[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);
var_dump($constituency);
exit;
$fleets = $constituency['data'];
$config['total_rows'] = $constituency['total'];
#17

[eluser]Bigil Michael[/eluser]
now that problem cleared
thank you so muchhhhhhh
#18

[eluser]Bigil Michael[/eluser]
one more help please

my table
Quote:id constituency_id candidate_name candidate_votes elect_year

1 2 Selvaraj 123456876 2011
2 4 kk 4678 2010
4 1 George 75 2011
5 1 Nagappan 15 2011
6 1 Suresh 5 2011
7 2 Ravi 20 2011
8 2 sajith 5 2011
10 1 sssssss 11111 2010

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()
{
this->db->select('candidate_name');
$this->db->select_max('candidate_votes');
$result_product = $this->db->get('candidate_details');
return $result_product->row_array();
}

it prints maximum votes
not candidate votes
i want the candidate name
can u help me??
thanks in advance........
#19

[eluser]Bigil Michael[/eluser]
now it shows an error like this

Quote:A Database Error Occurred

Error Number: 1140

Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) with no GROUP columns is illegal if there is no GROUP BY clause

SELECT `candidate_name`, MAX(`candidate_votes`) AS candidate_votes FROM (`candidate_details`) WHERE `constituency_id` = '1' AND `elect_year` = '2010'

can any one solve my problem
thanks in advance..
#20

[eluser]toopay[/eluser]
Use sub-query instead...
Code:
$query = $this->db->where('constituency_id', $id)
                  ->where('elect_year', $elect_year)
                  ->where('candidate_votes','(SELECT MAX(candidate_votes)FROM candidate_details)')
                  ->get('candidate_details');
Huh. Too much code here, not the right section for that. Next time, post your similar thread under 'CodeIgniter Core' or 'CodeIgniter Reactor' section, okay.




Theme © iAndrew 2016 - Forum software by © MyBB