Welcome Guest, Not a member yet? Register   Sign In
Question about models
#1

[eluser]darren884[/eluser]
Whats the table format? I could not find it in the user guide... say for instance if I had a table named online_games what would the model name be? Thanks...
#2

[eluser]Thorpe Obazee[/eluser]
The model names aren't associated with the table's names. You can name it anything as long as it follows the guidelines.

http://ellislab.com/codeigniter/user-gui...odels.html
#3

[eluser]darren884[/eluser]
So how does it know the table name?
#4

[eluser]Thorpe Obazee[/eluser]
They don't.
Code:
$query = $this->db->get($table_name);
return ($query->num_rows() > 0) ? $query->result() : FALSE;

although there are options like storing the table name in a property.
#5

[eluser]Dam1an[/eluser]
Although you can call your models anything you want, I call mine the singular of the table (in most cases)
So if I have a users table, the primary model for that table would be user (well, user_model.php, I add the suffix to avoid collisions)




Theme © iAndrew 2016 - Forum software by © MyBB