Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6824951
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T21:57:47+00:00 2026-05-26T21:57:47+00:00

I created an Sqlite3 database with PHP: $db = new SQLite3(‘mysqlitedb.db’); $db->exec(‘CREATE TABLE foo

  • 0

I created an Sqlite3 database with PHP:

$db = new SQLite3('mysqlitedb.db');
$db->exec('CREATE TABLE foo (bar STRING)');
$db->exec("INSERT INTO foo (bar) VALUES ('This is a test')");
$db->exec("INSERT INTO foo (bar) VALUES ('This is another test')");

but when I try to get all the rows:

$result = $db->query('SELECT * FROM foo');
var_dump($result->fetchArray());

it only returns the first row in the db:

array(2) { [0]=> string(14) "This is a test" ["bar"]=> string(14) "This is a test" }

I’m not sure why it isn’t returning all the rows.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T21:57:48+00:00Added an answer on May 26, 2026 at 9:57 pm

    You need to iterate over the rows. You’ll only get the current row.

    while($row=$result->fetchArray()){
       // Do Something with $row
       print_r($row);
    }
    

    The PHP Manual has a good example on the page

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following table in a SQLite3 database: CREATE TABLE overlap_results ( neighbors_of_annotation
I am making an sqlite3 test3.sql database, making table as CREATE TABLE rest (name
I need help with PHP PDO and SQLITE3. I have table device like CREATE
I've created an sqlite3 database from the command line and inserted several records. My
I am able to create a connection to a local sqlite3 database ( Using
I am new to using the SQLite database in iphone apps. I have created
How can I build a query with this format with a sqlite3 database? CREATE
I am working on iOS5.I am new for SQLite. I have created database named
Hello I have a Sqlite3 database created in my computer and I want to
I have an SQLite3 Database (created in a desktop sqlite application), with the android_metadata

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.