Here's an idea: assuming you have a table users with data in it and a
table schools that is empty.  In the users controller:

function test()
{
     $data = "select * from users limit 0,1";  //custom query, limit
to make things run faster
     $temp = $this->User->execute($data);
     if($temp)
     {
          debug('table exists');
     }
     else
     {
          debug('table does not exist');
     }
}

When I call /users/test, I get 'table exists'.  If I change $data to
use the schools table instead of the users table, I get 'does not
exist' - it returns no data because the table is empty.  If I change
users to a non-existent table like tests, I get 'does not exist' - the
table doesn't exist.

There may be a better way to do this, but I can't find it.


On Jan 20, 7:54 am, foxmask <[EMAIL PROTECTED]> wrote:
> Hello
> nobody to give a suggestion ?
>
> On Jan 18, 9:39 pm, foxmask <[EMAIL PROTECTED]> wrote:
>
> > Good evening,
> > I would like to test if my database table exists or not
> > If no,   i will display a message to suggest to install the software
> > If yes,  i will "Route::connect()"  to the main page of the software.
>
> > I digged on the Model::Schema() but i dunno how to use it nor if it's
> > the well way to do the trick.
>
> > kind regards.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to