0
Hello,
Guys, I got a big question here. I have a query where the user can select if they want to see all(Manager and Managers Jr), Only Managers Jr, or Directly select only one.
- All
 - Only managers Jr
 - John
 - Maria
 - etc....
 
The problem is when I select "2 - Only Managers Jr".
Because I have to go on the employee register and find out who the junior managers are (colab_func=3), so far so good.
After the previous consultation, where I receive the employee codes, I need to do the consultation itself, where I go in the sales table and look for the sales of these employees. That’s where I’m not getting it.
I’ll put a part of the code here:
$gerente = $_POST["txtgerente"];
if($gerente == 'T'){
    $query = "SELECT * FROM venda_dia WHERE venda_dia_aberto='S'";
    $tipo = "Todos";
} elseif ($gerente == 'GJR'){
    $query_ger = "SELECT colab_id FROM colaborador WHERE colab_funcao in($cod_gerjr)";
    $result_ger = mysqli_query($con, $query_ger) or die(mysqli_error());
    $row_ger = mysqli_fetch_array($result_ger);
    $query = "SELECT * FROM venda_dia WHERE venda_dia_cod_ger in($row_ger) AND venda_dia_aberto='S'";
    $tipo = "Gerente Júnior";
} else {
    $query = "SELECT * FROM venda_dia WHERE venda_dia_cod_ger='$gerente' AND venda_dia_aberto='S'";
    $query_gerente = "SELECT * FROM colaborador WHERE colab_id=$gerente";
    $result_gerente = mysqli_query($con, $query_gerente) or die(mysqli_error());
    $row_gerente = mysqli_fetch_array($result_gerente);
    $tipo = $row_gerente['colab_nome_venda'];
}
?>
<section id="cadastros">
    <fieldset id="cadastros"><legend><?php echo "Expositor com dia aberto - $tipo"; ?></legend>
         <table id="tab" align="center">
             <tr bgcolor="lightblue">
                 <th width="250px">Expositor</th>
                 <th width="150px">Dia Faturamento</th>
                 <th width="250px">Responsável</th>
              </tr>
              <?php 
                   $result = mysqli_query($con, $query) or die(mysqli_error());
                   while ($row = mysqli_fetch_array($result)) {
                        $cod_exp = $row["venda_dia_cod_exp"];
                        $data = $row["venda_dia_data"];
                        $cod_colab = $row["venda_dia_cod_colab"];
                        $cod_colab2 = $row["venda_dia_cod_colab2"];
                        // ESCREVE UMA LINHA NA TABELA
                        echo "<tr>";
                        echo "<td>";
                        $query_expositor = "SELECT * FROM expositor WHERE expo_id=$cod_exp";
                        $result_expositor = mysqli_query($con, $query_expositor) or die(mysqli_error());
                             while ($row_expositor = mysqli_fetch_array($result_expositor)) {
                                 $nome_expo = $row_expositor["expo_nome"];
                                 echo $nome_expo . "</td>";
                         }
                         echo "<td id='centro'>" . date('d/m/Y' , strtotime($data)). "</td>";
                         echo "<td>";
                         if($cod_colab2 == 0){
                             $query_colab = "SELECT * FROM colaborador WHERE colab_id=$cod_colab";
                             $result_colab = mysqli_query($con, $query_colab) or die(mysqli_error());
                             while ($row_colab = mysqli_fetch_array($result_colab)) {
                                   $colab_nome = $row_colab["colab_nome_venda"];
                                   echo $colab_nome . "</td>";
                              }
                          } else {
                              $query_colab = "SELECT * FROM colaborador WHERE colab_id=$cod_colab2";
                              $result_colab = mysqli_query($con, $query_colab) or die(mysqli_error());
                              while ($row_colab = mysqli_fetch_array($result_colab)) {
                                    $colab_nome = $row_colab["colab_nome_venda"];
                                    echo $colab_nome . "</td>";
                              }
                           }
                           echo "</tr>";
                        }
             ?>
When executing, gives me the following error:
Notice: Array to string Conversion in C: xampp htdocs Sistema_1_1 est_exp_opened.php on line 65
The line 65:
$query = "SELECT * FROM venda_dia WHERE venda_dia_cod_ger in($row_ger) AND venda_dia_aberto='S'";
Thanks for your help so far...
$row_geris an array of results from the first query, you can give aimplode(', ', $row_ger);or even make a single query replacingWHERE venda_dia_cod_ger in($row_ger)forWHERE venda_dia_cod_ger in($query_ger).– Benilson