Brief Forward: I tried to ask it on the FUEL forums, but every time I try and register, So their forum "sending failed activation email" and I can not log in or reset my account so hopefully people will see it here. I had previously seen some developers of fuel on this site.
Here is an example mysql table:
create table 'test' (`user_id` INT unacamelled tap AUTO_INCREMENT primary key, username 'VARCHAR (128) NULL,` last_login DATETIME NULL engine = InnoDB Obviously, unlike many people, I personally want to take advantage of the tap, the value of the database is in the common man's terms, zero means that it Not started with any price. In this case, if our user has never entered, then I would like to see that due to the fact that the tapering equivalent of the final recording is seen in his record. So, the cord = "never entered".
If I had to add a new user to my database through something like a phpMyAdmin or through the command line, then I would type in the following question.
`test` in INSTERT (` user_id`, `username ',' last_lagin`) value (zero, 'test_person_1', null); This is the result of that query.
+ --------- + ---------- ----- + ------------- - + | User_id | Username Last_lagin + --------- + --------------- + -------------- + | | 1 | Test_person_1 | Faucet + --------- + --------------- + -------------- + Now, use the Fuel's Active Record Here's my model (simple enough):
And here is a super-basic example of a controller method that records the records in the table. I know that I do not want to take such an action which repeatedly involves the same data repeatedly. This is just a test. Cool?
public function action_save_example1 () {$ o_user = new Model_Test (array ('username' = & gt; 'test_person_2',)); } And after running that method, I get this:
mysql> Choose * from the exam; + --------- + --------------- + --------------------- + | User_id | Username Last_lagin + --------- + --------------- + --------------------- + | 1 | Test_person_1 | Faucet | 2 | Test_person_2 | 0000-00-00 00:00:00 | + --------- + --------------- + --------------------- + 2 Rows in the set (0.00 seconds) Note that this field is not DATETIME field "0000-00-00 00:00:00" test_person_2. Even if I specifically say that last_login is zero, then the ActiveRecord class of fuel does not come in the tap. Examples.
public function action_save_example1 () {$ o_user = New Model_Test (array ('username' = & gt; 'test_person_2', 'last_login' = & gt; NULL)); } I'm guessing that this query is running ActiveRecord.
`portal_links```test` in INSERT (` user_id`, `username ',' last_translation ') value (zero,' test_person_2 ',' '); There should be some kind of logic to test, if there is value and === tap before entering or updating a value and if it is a tap, then using the keyword null. Should and not ''. The ActiveRecord class of CodeIgniter starts to understand the difference between NULL and ''
Not that this is the answer to your question. But AR is making or look at the new orm package that has just lost support.
Good luck.
Comments
Post a Comment