Cannot use PHP Mysqli SELECT from views.

I created a very simple view in my MySQL database through PHPMyAdmin. View works fine while it only:

SELECT * FROM MyTable

In PHPMyAdmin, I see the entire record selected by this request.

In my PHP code, I use the following code:

 $stmt = $this->conn->prepare("SELECT * FROM MyTable");
 $stmt->execute()
 .......

This works fine, I can read all the entries, but if I write:

 $stmt = $this->conn->prepare("SELECT * FROM MyView");
 $stmt->execute()
 .......

I get 0 entries.

I just repeat:

  • View works fine, it's really simple, just SELECT * FROM MyTable;
  • My PHP code works fine when I select from a table, but doesn't seem to work when I select from a view.

What's wrong?

Thanks in advance.

EDIT: The exception is the following:

Type: mysqli_sql_exception

Code: 1615

Message: Prepared expression needs to be reinstalled

+4
2

, mysqli.

, PDO .

0

, , SQL ​​ .

, . ( .)

.

, . , SQL-, PHP-, . ( ) myview vs myview. , MySQL ( ) , .

0

Source: https://habr.com/ru/post/1624637/


All Articles