Welcome Guest, Not a member yet? Register   Sign In
unable to fetch records from database
#2

(This post was last modified: 01-06-2016, 02:27 AM by mr_pablo.)

(01-06-2016, 02:16 AM)nady Wrote: Hi
whats wrong in my following query. i got the error
Error Number: 1054
Unknown column 't.user_id' in 'where clause'
-------------------------my query------------

function ShowTransData($data){
$this->db->select('*')
->from('transaction')
->join('user', 'transaction.user_id = user.user_id')
->where('t.user_id='. $data);
$query = $this->db->get();
return $query->result();

You are trying to get `t.user_id` but you have not assigned `t` to the `transaction` column

PHP Code:
function show_trans_data($data){
    
$this->db->select('*')
    ->
from('transaction as t')
    ->
join('user''t.user_id = user.user_id')
    ->
where('t.user_id'$data); // I'm guessing this is just an ID number?

    
$query $this->db->get();

    return 
$query->result();


I also tidied up your function.
Reply


Messages In This Thread
unable to fetch records from database - by nady - 01-06-2016, 02:16 AM
RE: unable to fetch records from database - by mr_pablo - 01-06-2016, 02:27 AM



Theme © iAndrew 2016 - Forum software by © MyBB