質問

Believe it or not I can not find an answer anywhere, it must be very simple...

I installed composer and imported in my project active record in my Test App.

Now i am trying to create a table dynamically from my script, something like

  • The user register
  • username and password get stored into user table
  • a new table for this user needs to be created

with plain php i would send a raw query(CREATE TABLE 'john_doe'...) with PDO

Is there a way to do it with Active Record?


Thanks, I tried using a model for an already existing table to create new tables and it worked, not sure yet about create a Connection object.

The documentation of this active record is not really for beginners, i am to use to the example of php.net, wish all the documentation were like that.

役に立ちましたか?

解決

You can send a raw query using phpactiverecord using the Connection::query('CREATE TABLE 'john doe'...) method.

If you using activerecord in your models, you can use the Model::query('blah'); method.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top