• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Unknown column 'Array'

#1
Hello,

I wonder why I get this error message? I thought I already define the array.

Error Number: 1054
Unknown column 'Array' in 'where clause'
SELECT `id` FROM `users` WHERE `referral_code` = Array
Filename: C:/xampp/htdocs/iPengen_Marketing_new/api/system/database/DB_driver.php
Line Number: 691



users_model.php

     function FindUserIdChild($data = array())
        {
        // referral code bkn marketing leader
        $this->db->select('id');
        $this->db->where('referral_code', $data);
        $this->db->from($this->table);
        return $this->db->get()->result();

        }

controllers/marketing.php
       
        $ref_code = 'ABC15';

        $dna['dna'] = $this->users_model->FindDnaCodeChild($ref_code);
        
        $users2 = $this->users_model->FindUserIdChild($dna);
" If I looks more intelligence please increase my reputation."
Reply

#2
Hi,

According to the documentation where() takes either an associative array as input or you have to call specify the field and value to look for.

PHP Code:
$dataArray=[
 
 'referral_code'=>'ABC15',
];
$this->db->where($dataArray);
// OR
$this->db->where('referral_code','ABC15'

Check here: https://www.codeigniter.com/user_guide/d...cific-data
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


Users browsing this thread:
1 Guest(s)


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2018 MyBB Group.