Welcome Guest, Not a member yet? Register   Sign In
I found issue with db driver
#5

(This post was last modified: 02-15-2015, 01:27 AM by twpmarketing. Edit Reason: syntax correction )

Vimal,
 The syntax of the where() clause is the problem.
From the User Guide (v. 3.0):

http://www.codeigniter.com/userguide3/da...cific-data

You can pass an associative array directly in the where() clause.  However your code assigns an variable ($community) to a column name ('community_name').  Because the column type is probably string, the error is generated when you assign an array ($community) to that string var.


Code:
where('community_name',$community)

I think you want to use either the  where_in() OR or_where_in() clause.  They are explained a few paragraphs below the User Guide link above.  Note that the array is NOT associative in this usage.

Quote:$this->db->or_where_in()


Generates a WHERE field IN (‘item’, ‘item’) SQL query joined with OR if appropriate

$names = array('Frank', 'Todd', 'James');
$this->db->or_where_in('username', $names);

// Produces: OR username IN ('Frank', 'Todd', 'James')
CI 3.1 Kubuntu 19.04 Apache 5.x  Mysql 5.x PHP 5.x PHP 7.x
Remember: Obfuscation is a bad thing.
Clarity is desirable over Brevity every time.
Reply


Messages In This Thread
I found issue with db driver - by Vimal - 02-13-2015, 03:22 AM
RE: I found issue with db driver - by Vimal - 02-13-2015, 03:23 AM
RE: I found issue with db driver - by Rufnex - 02-13-2015, 05:27 AM
RE: I found issue with db driver - by Vimal - 02-13-2015, 10:41 PM
RE: I found issue with db driver - by twpmarketing - 02-15-2015, 01:26 AM



Theme © iAndrew 2016 - Forum software by © MyBB