0
I have the following code
$sql = "
SELECT
c.*,
cl.razaosocial,
cl.idCliente
FROM
chamada as c,
cliente as cl
WHERE
c.idCliente = cl.idCliente";
$consulta = $this->db->query($sql)->result();
foreach($consulta as &$valor)
{
$this->db->where('idFuncionario', $valor->idFuncionario);
if($this->db->get('funcionario')->row('nome'))
{
$valor->funcionarioNome = $this->db->get('funcionario')->row('nome');
}
else
{
$valor->funcionarioNome = "";
}
}
return $consulta;
He returns in the $valor->funcionarioNome
always the same name.
What would have been wrong there?
I thought to try to make this SQL, it only displays those who are set the employees in the call, but there are calls in "open" no elected officials yet.
SELECT c.*, f.nome as nomeFuncionario, f.idFuncionario, cl.razaosocial, cl.idCliente FROM chamada as c, cliente as cl, funcionario as f WHERE c.idCliente = cl.idCliente AND c.idFuncionario = f.idFuncionario GROUP BY c.idFuncionario
$valor
should be an array of functionalities or just a?– rray
Just a clerk, actually, I just want his name...
– Sr. André Baill
Edit your question, describe what you want to do. Just by looking at the code it does not 'demonstrate' any intention.
– rray
I added the information
– Sr. André Baill