Warning: mysqli_num_rows() expects Parameter 1 to be mysqli_result,

Asked

Viewed 2,365 times

0

I just climbed my application to do a test on the server, sq always gives the error the following error

Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean given in /home/storage/5/71/81/cliente47/public_html/admin/filtros/tickets/EmAtendimentoTicket.php on line 34

Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean given in /home/storage/5/71/81/cliente47/public_html/admin/filtros/tickets/EmAtendimentoTicket.php on line 66

But on the local server this error does not happen.

The error stopped showing after removing the following line:

and t.status =  'Em Atendimento'

Only that line is responsible for the filter that this page has.

Archive: [Ematendimentoticket.php]

<?php
    include './function/dbh.php';


    $pagina = (isset($_GET['pagina']))? $_GET['pagina'] : 1;

    //Selecionar todos os usuario
    $sql = "
    SELECT
        T.id_ticket,
        T.assunto_ticket,
        T.open_ticket,
        T.id_cliente,
        T.status,
        C.id_cliente,
        C.nomeFantasia_cliente
    FROM
        ticket AS T
    INNER JOIN user_cliente AS C
    ON
        T.id_cliente = C.id_cliente and t.status =  'Em Atendimento'
    ORDER BY
        T.id_ticket ASC";

    //Executando query
    $ticket_cliente = mysqli_query($conn, $sql);

    //Contar total de usuarios
    $total_tickets = mysqli_num_rows($ticket_cliente );

    //Definir quantidade de clientes a serem exibidos por paginacao
    $quantidade_page = 6;

    //Calcular o numero de paginas necessarias para exibir todos os allClientes
    $num_paginas = ceil($total_tickets/$quantidade_page);

    //Calcular o inicio da visualizacao
    $inicio = ($quantidade_page*$pagina)-$quantidade_page;

    //Selecionar os clientes a serem apresentados
    $result_tickets = "
    SELECT
        T.id_ticket,
        T.assunto_ticket,
        T.open_ticket,
        T.id_cliente,
        T.status,
        C.id_cliente,
        C.nomeFantasia_cliente
    FROM
        ticket AS T
    INNER JOIN user_cliente AS C
    ON
        T.id_cliente = C.id_cliente and t.status =  'Em Atendimento'
    ORDER BY
        T.id_ticket ASC
    LIMIT 
        $quantidade_page OFFSET $inicio ";

    $result = mysqli_query($conn, $result_tickets);
    $total_tickets = mysqli_num_rows($result); 
    ?>
  • Every time you apply mysqli_query you can use it like this mysqli_query($conn, $sql) or die(mysqli_error($conn)); and will be able to identify which was the syntax error in the query.

  • made the change, on the local server did n, sq on online gave the following error Unknown column’t. status' in 'on clause'

  • I have already deleted database and imported my sq location is giving this error on the online server

  • Unknown column’t. status' You used the letter "T" in minuscule, but the correct as the AS is "T" in maisculo, the broker would be T.status

  • 1

    Thanks for the help.

  • For nothing, welcome to the community!

Show 1 more comment
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.