Welcome Guest, Not a member yet? Register   Sign In
Replace comma[,] with space['']
#1

[eluser]Unknown[/eluser]
Hi ,


$classlist=array('AAA','AA','A','B','C','D','E');
$query=$this->db->select("class, sum(replace(fieldname),',','') as field")
->from($this->table1)
->group_by('class')
->where('idtfieldname',$subid)
->where_in('class',$classlist)
->get();
------------------------------------------------------------------------------------------
in above code i want to replace the comma[,] with space['']. manually i try this code it is working fine
but when i try in codeigniter`. i am getting this error ..




<h1>A Database Error Occurred</h1>
<p>Error Number: 1064</p><p>You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' `''))` as field
FROM (`tablename`)
WHERE `idtfieldname` = '22'
AND `cla' at line 1</p><p>SELECT `class`, sum(replace(fieldname, `'`, `'`, `''))` as field
FROM (`tbuilding`)
WHERE `idtfieldname` = '22'
AND `class` IN ('AAA', 'AA', 'A', 'B', 'C', 'GOV', 'WRHS')
GROUP BY `class`</p> </div>

help me ....to solve this my email id is [email protected]

thanks in advance ...





Theme © iAndrew 2016 - Forum software by © MyBB