Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
$total_demo = DB::count_records('mydb'); get error
  • Hi, when im try to use  $total_empresa = DB::count_records('mydb');  im get error:

    Fuel\Core\Database_Exception [ Error ]: SQLSTATE[42S02]: Base table or
    view not found: 1146 Table 'demo.mydb' doesn't exist with query:
    "SELECT COUNT(*) AS total_row_count FROM `mydb`"

    the database exist, and I can access it with Model_Mydb :: find
  • Query looks perfectly fine. Assuming your table name isn't prefixed, I wouldn't know what causes this.

    What happens if you do DB::query("SELECT COUNT(*) AS total_row_count FROM `mydb`")->execute(); instead?
  • the same mistake

    Fuel\Core\Database_Exception [ Error ]: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'demo.mydb' doesn't exist with query: "SELECT COUNT(*) AS total_row_count FROM `mydb`"

    i have fuelphp 1.4
  • That's odd.

    ORM uses the same DB queries, so I don't see why that would work. Have you defined a $_table in your ORM model so that is accesses a different table?

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion