Welcome Guest, Not a member yet? Register   Sign In
[CodeIgniter1.6.1]DB_active_rec.php / select function problem
#1

[eluser]Unknown[/eluser]
Hi all!!

ar_select[] needs to be modified to handle duplicated nodes.

Here's how you can reproduce my problem.

Code:
...
$this->db->select('substring(f_1,1,5),substring(f_1,6,5),f_2,f_3',FALSE);
$query = $this->db->get('TEST_Table', $n, $f);
...

Then ar_select[] tries to hold values :
[0]=substring(f_1
[1]=1
[2]=5)
[3]=substring(f_1
[4]=6
[5]=5)
[6]=f_2
[7]=f_3

However it doesn't take node 2 & 3 because of duplication.

So it will end up with
Code:
'substring(f_1,1,5),6,f_2,f_3'
.

Here's a workaround
If you use 2 different functions in SQL, it works.

Code:
substring(f_1,1,5),substr(f_1,6,5 ),f_2,f_3
                   ^^^^^^        ^^

Yes. we have a space between "5" and ")".




Thanks,




Theme © iAndrew 2016 - Forum software by © MyBB