I’m confused about simple problem:
-
What is the difference between the active record and the native query?
-
If I have a trouble when coding CI, what should i do? are there trouble shoot? what fiter should i use?
-
What is the difference between CI session and PHP session
Thanks for your answer
Here’s what I found about the difference, but still does not make me statisfied:
The Session class permits you maintain a user’s “state” and track their activity while they browse your site. The Session class stores session information for each user as serialized (and optionally encrypted) data in a cookie. It can also store the session data in a database table for added security, as this permits the session ID in the user’s cookie to be matched against the stored session ID. By default only the cookie is saved. If you choose to use the database option you’ll need to create the session table as indicated below.
CodeIgniter’s "Active Record" isn’t what the real active record is all about. An active record is like your database in PHP form. you interface with it using PHP than using sql queries. it’s like having that feeling that the database data is in PHP rather than in the database.
In CI, their active record is just a plain old "query builder" which build your SQL query in a clean, OOP-looking way and returns a cleanly formatted result thanks to several methods that format it to your liking (like
result_array()for an array-formatted result, orresult()for an object-formatted result).CI also uses sessions, much like PHP sessions the difference is where it’s stored.
unlike PHP where session data remains in the server and identified with the cookie sent or a passed session id, CI encodes it’s session data into the cookie itself. that’s also why you need a session "key" prior to using sessions to encrypt your session data because storing sessions in cookies is unsafe. why they do this, i don’t know, maybe to optimize the server and avoid storing data to it, sacrificing load speeds