Jump to content

database table for model was not found


neginf

Recommended Posts

Trying to make a hello world program in the MVC way. The code for what I'm trying is below. There is no data yet, trying to get this to work.

I get warnings related to mysql and an error saying "Database table trys2 for model Try2 was not found."

 

1. Does a model have to have a table associated with it ?

2. How can I make this program work ?

 

 

 

This is c:\inetpub\wwwroot\cakephp\app\models\try2.php

< ?php
class try2 extends AppModel
{
}
?>

This is c:\inetpub\wwwroot\cakephp\app\controllers\try2s_controller.php

< ?php
class Try2sController extends AppController
{
   function try2s()
   {
      $test='hello world';
      $this->set('test',$test);
   }
}
?>

This is c:\inetpub\wwwroot\cakephp\app\views\try2s\try2s.ctp

< pre>
   <?php print_r($test)?>
< /pre>

 

Link to comment
https://forums.phpfreaks.com/topic/277583-database-table-for-model-was-not-found/
Share on other sites

After try3 worked, tried try2 with $uses=null; before the function in the controller. That made it work.

Made the change to the capitalization in the model you suggested. Saw article saying file and directory naming is different in 1.3.2 and 2.0 and on.

Thank you for helping.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.