$query = "SELECT * FROM VISITOR";
if($result = $VISITOR->query($query, SQLITE_BOTH, $error))

Fatal error: Call to a member function query() on a non-object in ...file path. I keep getting this error. Can anyone help?

Thanks

Recommended Answers

All 4 Replies

What is $VISITOR supposed to be? You're treating it like an object, but the code you posted doesn't show it being instantiated.

What is $VISITOR supposed to be? You're treating it like an object, but the code you posted doesn't show it being instantiated.

$VISITOR is a Table.

There's your answer. VISITOR is a table in your database. PHP has no clue about it, and you certainly can't use it as a PHP object like you have.

It looks like you're using SQLite. Look at the documentation for how to run a query with that.

Could anyone direct me to what kind of coding I would need to query a database?

Thanks in Advance

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.