N
N
NoName_02016-07-16 15:46:54
linux
NoName_0, 2016-07-16 15:46:54

Sqlite3::query unable to prepare statement, file encrypted ..?

I look, it means Borisov's ajax courses, he has php on the server, and connects to the database via sqlite2 ... but I have sqlite3 on the server and I can’t connect to the database, despite the fact that I converted it from sqlite2 to sqlite3 ... Apache all the time produces an error 500 for some reason ... in the logs there is such an error sqlite3::query(); unable to prepare statement

Here is the general code, ajax get pulls this file, it should return the result of the request to the database .. What's wrong? why is it getting error 500?

<?php

header('Content-type: text/plain; charset=utf-8');
header('Cache-Control: no-store, no-cache');
header('Expires: ' . date('r'));

$db = new SQLite3("books3.db");

echo getChildCategories($db);

unset($db);

function getChildCategories($db, $parent=0, $indent="")
{
  $sql = 'SELECT * FROM category';
  $res = $db->query($sql);
  $result;
  $i = 0;

  while ($row = $res->fetchArray())
  {
    $result[$i] = $row['id'];	

    $i++;
  }
  return $result
    
}

?>

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question