Good day. Either I do not understand something, or I have forgotten how. There is such a code:

$db = new SQLite3('../database/database.db'); $result = $db->query("SELECT * FROM users"); $users = $result->fetchArray(SQLITE3_ASSOC); var_dump($users); 

According to the idea, he should remove all the records from the table, but only output one.

Var_dump output

Data in the table

    1 answer 1

    Everything is doing right.

    http://php.net/manual/en/sqlite3result.fetcharray.php

    fetchArray only one row.

    if you need all that:

     while($row = $result->fetchArray()) { // ... } 

    If you want everything at once, then hurry to PDO (supports SQLite) http://php.net/manual/ru/ref.pdo-sqlite.php

    http://php.net/manual/ru/pdostatement.fetchall.php - will return everything at once.

    • Thank. Not attentive to the question - LevBazdyrev
    • it's the same operator. You can simply convert the integertoarray to the array. writing from the phone could be wrong - Naumov
    • @Naumov are you talking about ?? - LevBazdyrev