(11-25-2017, 11:56 AM)PaulD Wrote: Your query is asking for:
PHP Code:
->select('payment_amount', 'payment_description','payment_student');
But your array is not showing those indexes. I do not understand why not.
You have a missing index 'payment_description'. In the error message, where is it indicating this is an issue, as if it does not exist in your database I am not certain how the query would run in the first place. Is it in the model, the controller or the view?
Perhaps you are fiddling with the code between pastes, but the query string you posted is different as it is not selecting 'payment_description', so where did that come from?
Paul.
Whats the problem with query in this model?
PHP Code:
$this->anotherDb
->where('payment_student', $result[$i]['id'])
->where('date_format(fee_month,"%d-%m%Y") >=date_format(curdate(),"00-%m-%Y")')
->where('payment_status=0');
$this->anotherDb
->select('payment_amount', 'payment_description','payment_student');
$query = $this->anotherDb->get('payments');
echo $this->anotherDb->last_query();
returns the following, means the about ->select has problem, here is only payment_student.
PHP Code:
SELECT `payment_amount` FROM `payments` WHERE `payment_student` = '44' AND date_format(fee_month,"%d-%m%Y") >= date_format(curdate(),"00-%m-%Y") AND `payment_status` =0
I can execute the following in query in mysqlworkbench.
PHP Code:
SELECT payment_description, payment_student, payment_amount FROM payments;