0

I'm running xampp.

I created a basic db call mydb.sq3 and a basic table called panels. That all seems to work fine because when I call SELECT * FROM panels; from the command line it is all good. But there is an error that keeps getting thrown when i run my php file:

Fatal error: Call to undefined function query() in > C:\xampp\htdocs\example\myphp.php on line 10

<?php
    $db = new SQLite3('mydb.sq3');
    $result = $db-->query('SELECT * FROM panels');
    while ($row = $result->fetchArray(SQLITE3_ASSOC))
    {
          echo $row['firstname'] . ': $' . $row['surname'] . '<br/>';
    }
   unset($db);
?>

Cheers

1
  • one to many dashes --------- Commented Jun 5, 2016 at 5:07

1 Answer 1

1

There is an error in line 3

Use this-

$result = $db->query('SELECT * FROM panels');

Instead of this -

$result = $db-->query('SELECT * FROM panels');

Simple typo error you used '--' instead of '-' Enjoy :)

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.