PHP uses PDO to manipulate SQLite cannot execute WHERE in () Please advise ~

Source: Internet
Author: User
This post was last edited by Dlebh on 2013-09-17 14:28:12

php + SQLite

Field titles are indexes!

$sql = "Select * from Fang where titles in (' Kill ')"; $result = $dbh->query ($sql); $r = $result->fetchall ();


Return error: Fatal Error:call to a member function Fetchall () on a non-object in


There are no errors in the statement that can be performed normally but cannot be run in PHP.

What's the reason, please, thank you for your advice.


Reply to discussion (solution)

Which Daniel can instruct twos ah ....

The support! Maybe you wrote it wrong.
Print_r ($DBH->errorinfo ());
Let's see what's wrong.

Oh, okay, I'll try.

Array ([0] = HY000 [1] = 1 [2] = no such column:titles)

Out of this error

The support! Maybe you wrote it wrong.
Print_r ($DBH->errorinfo ());
Let's see what's wrong.

Array ([0] = HY000 [1] = 1 [2] = no such column:titles)

Out of this error

No such column:titles
There is no such column: titles

You wrote the wrong thing, the machine won't lie to you.

$a = $dbh->query (' SELECT * from Sqlite_master ');p rint_r ($a->fetchall (PDO::FETCH_ASSOC));
Compare SQL Columns

No such column:titles
There is no such column: titles

You wrote the wrong thing, the machine won't lie to you.

$a = $dbh->query (' SELECT * from Sqlite_master ');p rint_r ($a->fetchall (PDO::FETCH_ASSOC));
Compare SQL Columns

Fatal Error:call to a member function Fetchall () on a non-object

Or is it a mistake to explode?

My SQL statement is fine. You can perform the display results in SQLite
It's the end of the PDO, isn't it? Does PDO not support indexed columns?


No such column:titles
There is no such column: titles

You wrote the wrong thing, the machine won't lie to you.

$a = $dbh->query (' SELECT * from Sqlite_master ');p rint_r ($a->fetchall (PDO::FETCH_ASSOC));
Compare SQL Columns

Fatal Error:call to a member function Fetchall () on a non-object

Or is it a mistake to explode?

My SQL statement is fine. You can perform the display results in SQLite
It's the end of the PDO, isn't it? Does PDO not support indexed columns?


Sorry about the mistake. The output does not have a titles column.

But I do have this index column when I build my watch. And I'm sure it's okay to query in SQLite.

Why didn't you come here?

Just started with SQLite may have some misunderstanding?

SELECT * from Sqlite_master
Also not supported? Are you SQLite 2?

SELECT * from Sqlite_master
Also not supported? Are you SQLite 2?




Thank you for the moderator reason to find, originally troubled me two days of the problem is that my database address is wrong

I built two libraries. One less field I've been using this wrong database address for the last two days .....

haha too hard to force this time

Thank you very much for your enthusiastic reply.

I thanked you for being here.

$sth = $db->query ($sql);
$row = $sth->fetchall ();



Thank you very much for your enthusiasm. haha haha

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.