0

I have a file.db (binary) that I can read from SQlite 3.exe, but I want to echo out the information with a while ordered in a table. I have the following code:

<?php
$db = new PDO('sqlite:file.db');
$query = $db->prepare("SELECT * FROM `Timers` LIMIT 1");
$query->execute();
while($row = $query->fetchObject())
{
    echo $row->Values;
}
?>

Expected result:
512

Actual result:
Notice: Undefined property: stdClass::$Values

Bona Chon
  • 955
  • 3
  • 9
  • 11
  • 1
    The variable `$row` is an instance of `stdClass` and the error above says that in this instance the property `Values` doesn't exist. Try to write `var_dump($row)` and see the output. – Igor Timoshenko May 08 '12 at 21:18

1 Answers1

0

Unless you have a column named "Values" - there's no way that this would work. The returned object will have properties named identically to the fetched column names. http://www.php.net/manual/en/pdostatement.fetchobject.php

Narf
  • 14,600
  • 3
  • 37
  • 66