I have an error in queries with codeigniter, I do not know how to eliminate those inverted quotes that are generated when passing the variable $ id2, and I do not recognize the variable $ id2 as a number.
function Consulta_iClientesall($id2)
{
$this->db->select('timeZone.zone, clientes.iCliente,clientes.Telefono1, clientes.Telefono2 ');
$this->db ->from('timeZone');
$this->db->join('clientes',"clientes.iCliente= '$id2'" ,'inner');
$this->db->where('SUBSTRING(clientes.Telefono1,1,4)= timeZone.areaCode ');
$this->db->or_where('SUBSTRING(clientes.Telefono2,1,4)= timeZone.areaCode');
//$this->db->get();
return $this->db->get()->result_array();
}
this is the error that returns me
Error Number: 1064
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 '' WHERE SUBSTRING (clients.Telephone1,1,4) = timeZone.areaCode OR SUBSTRING (clien 'at line 3
SELECT
timeZone
.zone
,clientes
.iCliente
,clientes
.Telefono1
,clientes
.Telefono2
FROM (timeZone
) INNER JOINclientes
ONclientes
.iCliente
= '149'
WHERE SUBSTRING (clients.Telephone1,1,4) = timeZone.areaCode OR SUBSTRING (clients.Telephone2,1,4) = timeZone.areaCode
what do you suggest?