Welcome Guest, Not a member yet? Register   Sign In
Quotes in query
#1

[eluser]ZioN[/eluser]
Hi,

I'm working on a project and I need to use a query to search for a name(can be left blank) and multiple zipcodes.

I need to produce this:

Code:
SELECT * FROM (`TABLE`) WHERE `name` like '%%' and Zipcode ('0000', '0001', '0002')

This way it works. This is the code I use:

Code:
$this->db->select('*');
$this->db->from('TABLE');
$this->db->where_in('Zipcode', $var);
this produces:

Code:
SELECT * FROM (`TABLE`) WHERE `Zipcode` IN ('0000,0001,0002') and `name` LIKE '%%'

If I try to test the codeigniter query by setting the zipcodes in an variable manually like this:

$string = '0000', '0001'
codeigniter is producing \'0000\', \'0001\'

I've been lurking the user guide for answers already but without result.

Thanks!


Messages In This Thread
Quotes in query - by El Forum - 10-21-2013, 01:18 AM
Quotes in query - by El Forum - 10-21-2013, 02:17 AM
Quotes in query - by El Forum - 10-21-2013, 02:40 AM
Quotes in query - by El Forum - 10-21-2013, 03:50 AM
Quotes in query - by El Forum - 10-21-2013, 05:00 AM
Quotes in query - by El Forum - 10-21-2013, 05:02 AM
Quotes in query - by El Forum - 10-21-2013, 05:16 AM
Quotes in query - by El Forum - 10-21-2013, 05:28 AM
Quotes in query - by El Forum - 10-21-2013, 05:36 AM
Quotes in query - by El Forum - 10-21-2013, 05:51 AM
Quotes in query - by El Forum - 10-21-2013, 06:10 AM
Quotes in query - by El Forum - 10-21-2013, 07:10 AM
Quotes in query - by El Forum - 10-21-2013, 07:15 AM
Quotes in query - by El Forum - 10-21-2013, 07:20 AM



Theme © iAndrew 2016 - Forum software by © MyBB