Error when displaying the number of records in a table

Asked

Viewed 39 times

1

I’m using this code:

/* Select Count de Ativos */

    $tativos = "SELECT count(*) from ativos";
    $lista_ativos = mysqli_query($tativos);

    if(!$lista_ativos)
    {
        die("Erro no Banco - CONTAR ATIVIDADES PENDENTES");
    }

    /* Fim do Select Count de Ativos */

In order to count how many records I have in my table ativos from the database, I ran the query above, however the query ta dying, ie in my browser is showing the message:

Bank Error - COUNT PENDING ACTIVITIES

I am connected to the database by the session system.

  • 1

    The procedural call of mysqli_query expects two parameters. Shouldn’t you be passing the connection object with the bank as well? By the way, if this did not show the error on the screen I would suggest you review your development server settings. Development environment that hides error is not a good environment.

  • Thanks for your attention Anderson. You indicate some development server?

  • There is an example of php.ini in the official PHP repository recommending some settings: https://github.com/php/php-src/blob/master/php.ini-development. Start by studying them and adapting them to your needs.

  • I will read it now. I thank you once again for your attention.

No answers

Browser other questions tagged

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